Hi I need a little help with this code that I've been writing for an assignment. This is what I have:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
#include <stdio.h>
#include <iostream>
#include <cmath>
using namespace std;
class personalComputer {
private:
string manufacturer;
string model;
string serialNumber;
string cpu;
int memory;
double speed;
string operatingSystem;
double diskSize;
string graphicsCard;
int usbPortcount;
int bootState;
public:
personalComputer(string manufacturer, string model, string serialNumber, string cpu, int memory, double speed, string operatingSystem, double diskSize, string graphicsCard, int usbPortcount, int bootState);
~personalComputer();
string getManufacturer() const{
return manufacturer;
};
string getModel() {
return model;
};
string getSerial()const {
return serialNumber;
};
string getCpu()const {
return cpu;
};
double getSpeed() const{
return speed;
};
int getMemory() const{
return memory;
};
double getDisksize()const {
return diskSize;
};
string getGraphicscard()const {
return graphicsCard;
};
int getUsbports() const {
return usbPortcount;
};
int getBootstate() const {
return bootState;
};
string getOperating() const {
return operatingSystem;
};
void setManufacturer(string manu) {
};
void setModel(string mode) {
};
void setSerial(string seri) {
};
void setCpu(string cp) {
};
void setSpeed(double spee) {
if (spee >= 0) {
speed = speed;
}
else {
cout << "Please enter a valid input ( a positive number)." << endl;
cin >> spee;
}
};
void setMemory(int mem) {
if (mem >= 1) {
mem = memory;
}
else {
cout << "Please enter a valid input." << endl;
cin >> mem;
}
};
void setDisksize(double disk) {
if (disk >= 1) {
disk = diskSize;
}
else {
cout << "Please enter a valid input." << endl;
cin >> disk;
}
};
void setGraphicscard(string graphics) {
};
void setOperating(string op_sy) {
};
void setUsbports(int usb) {
if (usb >=0) {
usb = usbPortcount;
}
else {
cout << "Please enter a valid input." << endl;
cin >> usb;
}
};
void setBootstate(int boot) {
if (boot ) {
boot = bootState;
}
else {
cout << "Please enter a valid input ( 0 for shut off, 1 for turn on." << endl;
cin >> boot;
}
};
int main()
{
personalComputer comp;
string manu;
string mode;
string seri;
string cp;
int mem;
double spee;
string op_sy;
double disk;
string graphics;
int usb;
int boot;
int spec1;
int spec2;
int spec3;
cout << "This program displays the attributes of a personal computer based on the data you provide. Please enter the specifications of your computer when prompted. " << endl;
cout << "Please enter the manufacturer of your computer.";
cin >> manu;
cout << endl;
comp.setManufacturer(manu);
cout << "Please enter the serial number of your computer.";
cin >> seri;
cout << endl;
comp.setSerial(seri);
cout << "Please enter the CPU name of your computer.";
cin >> cp;
cout << endl;
comp.setCpu(cp);
cout << "Please enter the speed of your computer.";
cin >> spee;
cout << endl;
comp.setSpeed(spee);
cout << "Please enter the memory of your computer.";
cin >> mem;
cout << endl;
comp.setMemory(mem);
cout << "Please enter the disk size of your computer.";
cin >> disk;
cout << endl;
comp.setDisksize(disk);
cout << "Please enter the operating system of your computer.";
cin >> op_sy;
cout << endl;
comp.setOperating(op_sy);
cout << "Please enter the number of USB ports on your computer.";
cin >> usb;
cout << endl;
comp.setUsbports(usb);
cout << "Please enter the graphics card of your computer.";
cin >> graphics;
cout << endl;
comp.setGraphicscard(graphics);
return 0;}};
| |
I have a couple more sections to add on this, but I keep on getting error messages for part of it. I'm not really sure what I'm not really sure what I'm doing wrong when I try to fix it, because the error code keeps changing.
Here is the error log for this from c++ shell
In member function 'int personalComputer::main()':
125:26: error: no matching function for call to 'personalComputer::personalComputer()'
125:26: note: candidates are:
25:5: note: personalComputer::personalComputer(std::string, std::string, std::string, std::string, int, double, std::string, double, std::string, int, int)
25:5: note: candidate expects 11 arguments, 0 provided
11:7: note: personalComputer::personalComputer(const personalComputer&)
11:7: note: candidate expects 1 argument, 0 provided
206:24: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
136:13: warning: unused variable 'boot' [-Wunused-variable]
139:13: warning: unused variable 'spec3' [-Wunused-variable]
I'm not sure what I"m doing wrong on the personalComputer section.