efine a base class named Computer whose components are wordSize (in bits), memorySize (in megabytes), storageSize (in megabytes), and speed (in megahertz). Derive a Laptop class that is a kind of Computer, but also specifies the object's length, width, height (inches), and weight (pounds). Member functions for both classes should include a default constructor and a constructor that initializes

all components.

What will be an ideal response?



#include
using namespace std;

class Computer { // specifications of a computer
public:
Computer() {}
Computer( int, int, double, int );
protected:
int wordSize; // bits
int memorySize; // megabytes
double storageSize; // megabytes
int speed; // megahertz
};

class Laptop: public Computer { // Laptop specs
public:
Laptop() {}
Laptop( int, int, double, int, double, double, double, double );
private:
double length, width, height; // inches
double weight; // pounds
};

Computer::Computer( int wdSiz, int memSiz, double storSiz, int spd )
{
wordSize = wdSiz;
memorySize = memSiz;
storageSize = storSiz;
speed = spd;
}

Laptop::Laptop( int wdSiz, int memSiz, double storSiz, int spd,
double len, double wid, double ht, double wt )
:Computer( wdSiz, memSiz, storSiz, spd )
{
length = len;
width = wid;
height = ht;
weight = wt;
}

Computer Science & Information Technology

You might also like to view...

Use the Visible property in a report to hide a control when the control's value is the same as the value of the preceding record in the group. ____________________

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Change the timing setting to change the speed of a transition. _________________________

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

What statement regarding the use of distributed switches is accurate?

A. A distributed switch exists only within a single vSphere hypervisor, but is shared with multiple VMs. B. A distributed switch is not compatible with the use of vMotion. C. A distributed switch can be shared among multiple associated vSphere hosts, providing consistent network configuration. D. A distributed switch can't make use of port groups.

Computer Science & Information Technology

If you want to send the value contained in a variable to a function, which method should you use?

A. passing by value B. calling by reference C. calling by value D. passing by reference

Computer Science & Information Technology