Answered You can hire a professional tutor to get the answer.

QUESTION

Consider the following class: class Computer { public:

Consider the following class: class Computer { public: Computer(); Computer(int s, int mm, int hm); void display_specs(ostream & out)const; int get_speed()const; int get_mmemory()const; int get_hmemory()const; private: int speed; int main_memory; int harddisk_memory; };

(a) Implement class Computer.

(b) Test class Computer in a driver program that does the following:

 instantiates an object of class Computer, with the following details:

speed: 1600

main memory: 4

hard disk: 16

 use the accessor functions to display the specifications of the instantiated object on the console

 display the specifications of the instantiated object on the console with the member function display_specs().

(c) Derive and implement a class Laptop from class Computer. This class has additional member variables, battery_time and weight. Class Laptop also has an overloaded constructor and member functions, get_battime() and get_weight()to return member variables battery_time and weight respectively. The class Laptop should override function display_specs() in order to display the member variables of Laptop.

Implement the overloaded constructor for the class Laptop by invoking the base class constructor.

(d) Test class Laptop in a driver program that does the following:

 instantiates an object of class Laptop, with the following details:

speed: 1333

main memory: 2

hard disk: 8

battery time: 8

weight: 1.25

 use the accessor functions to display the specifications of the instantiated object on the console.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question