++ question 1 Monitor class header file: Monitor.h Instructions: 1. Code the class specification file and name it as Monitor.h. You can code the constructor initialization steps in-line. The rest of the member functions should just be prototypes. The class specification should define the prototypes of each functions.
C++
question 1
Monitor class header file: Monitor.h
Instructions:
1. Code the class specification file and name it as Monitor.h. You can code the constructor initialization steps in-line. The rest of the member functions should just be prototypes.
The class specification should define the prototypes of each functions.
Class name: Monitor
Private Member Attributes:
- string brand
- string model
- int width (px)
- int height(px)
- int ppi
- double refreshRate (hz)
- char speakers (Y/N)
- int ports (no. of ports)
- string portType (list of port types separated by commas)
Public Member Inline Functions
- Default Constructor with no parameters will initialize all numeric variables to 0.
- Constructor that accepts 3 int parameters for width, height, ppi. This constructor defaults the brand to "Generic", model to "Basic", the refreshRate to 60, speakers to 'N', ports to 1, and portType to "HDMI".
- Destructor (empty destructor)
Public Member Functions as Prototypes:
- Prototype for Setters (Mutators) for each member attribute that takes parameter for the attribute and returns no value.
- Prototype for Getters (Accessors) for each member attribute returns the data type as specified in the attribute list.
- Prototype for getScreenSize() function that calculates and returns the diagonal size of the monitor in inches. Be sure the data types will not demote numbers in the calculations. Use the formula:
Use: sqrt() and pow(x,y) functions
4. Prototype for listMonitor() that takes no parameter and no return value but generates cout of the the Monitor as:
Brand: Acer,Model: H243H,Screen size (pixels) 1920x1080 @ 70ppi, (diagonal) "result of getScreenSize"
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 2 images