Print Name __________________________
Signature __________________________
Computer Class Lab
Individual Assignment
15 Points
2] Use the following class definition
| class Computer
{ public:
private:
|
3] Use the following main program. Replace the ???? with
your name.
| main (int argc, char * argv[])
{ cout << "############################### Start of Main #####################\n"; cout << " Computer Class - Overloading Methods \n"; cout << " written by \n"; cout << " ???? \n\n\n"; cout << "###################################################################\n"; Computer
cout << "\n##############
Check Out Constructor Initializations ############\n";
Systems[0].Display("Computer
Systems[0]:");
cout << "\n#######################
Call Set Method ##########################\n";
cout << "\n#####################
Check Out Set Method ########################\n";
cout << "\n##################### Check
Out Get Method ########################\n";
|
4] Always document the program and each module/function/method.
Make sure that your purpose is always clear.
| //////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////// // // // Computer [Constructor] // // // // Purpose : Create and initialize a Computer Object. Set the Brand Name // // to NewBrandName [default blank]. Set the RamMegaBytes to // // to NewRamMegaBytes [default 0]. Set the HardDriveGigaBytes to // // to NewHardDriveGigaBytes [default 0]. Set the NewMonitor to // // to NewMonitor [default false]. Constructor has all four // // overloaded with default values. // // // // Written By : Environment : // // Date : Compiler : // ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// Computer::Computer (char NewBrandName[], long int NewRamMegaBytes, long int NewHardDriveGigaBytes, bool NewMonitor) { cout << "Evoking Destructor ~Computer(void)\n"; } //////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
|
5] Write the code for each of the Computer class methods/functions.
6] Do the following when program is complete.
g++ Computer.cpp.
-o Computer <-- Binary File
Will Be Called Computer
- Not a.out
Computer > Output.txt
<--
Runs the program and dumps output into file Output.txt
When you redirect the output to file Output.txt, the prompts will go there as well. The program stop at the Get and you will be expected to enter the
in what every order you selected in your Get Module - You will see no prompts!
A] Divider
B] Copy of this assignment sheet. Using an ink pen, print your name and sign this lab at the top.
C] Printout Computer.cpp
D] Printout Output.txt
E] Disk containing the files.