What you need to do: Use Visual Studio to create a new project. Create the follo
ID: 3811922 • Letter: W
Question
What you need to do: Use Visual Studio to create a new project. Create the following classes: Computer and Monitor Computer should have The following instance variables and related methods serialNumber (String) - needs accessor chipset (String) - accessor gbMemory (int) - accessor and mutator gbStoragc (int) - accessor and mutator monitor (Monitor) - accessor and mutator The following instance methods One constructor that takes serialNumber and chipset printlnfo() which prints information about the Computer Monitor should have The following instance variables and related methods display (String) - accessor and mutator The following instance methods clear() - sets the display to empty stringExplanation / Answer
Here are the 2 classes for you:
#include <iostream>
using namespace std;
class Monitor
{
string display;
public:
void setDisplay(string dis) { display = dis; }
string getDisplay() { return display; }
void clear() { display = ""; }
};
class Computer
{
string serialNumber;
string chipset;
int gbMemory;
int gbStorage;
Monitor monitor;
public:
Computer(string sNo, string cS)
{
serialNumber = sNo;
chipset = cS;
}
string getSerialNumber() { return serialNumber; }
string getChipSet() { return chipset; }
int getGBMemory() { return gbMemory; }
void setGBMemory(int gb) { gbMemory = gb; }
int getGBStorage() { return gbStorage; }
void setGBStorage(int gb) { gbStorage = gb; }
string getMonitor() {return monitor.getDisplay(); }
void setMonitor(string dis) { monitor.setDisplay(dis); }
void printInfo()
{
cout << "Serial Number: " << serialNumber << endl;
cout << "Chip set: " << chipset << endl;
cout << "Memory capacity: " << gbMemory << " GB." << endl;
cout << "Storage capacity: " << gbStorage << " GB." << endl;
cout << "Display: " << getMonitor() << endl;
}
};
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.