Question: C++ Question 30 _____ is commonly used to extend a class or to give it additional capabilities. Privacy Inheritance The constructor The destructor Question 31
C++
Question 30
_____ is commonly used to extend a class or to give it additional capabilities.
| Privacy | |
| Inheritance |
| The constructor | |
| The destructor |
Question 31
Write an Employee class that has data members for hourly pay rate and number of hours worked. The default constructor should set the hours worked and pay rate to zero. The class must have an accessor method for both the hours worked and rate of pay. The class must have mutator method for both the hours worked and rate of pay. Finally, the class should have a calculatePay method that returns the weekly pay based on the hours worked times the hourly pay rate.
Question 32
Demonstrate inheritance. Create an Airplane class with the following attributes: manufacturer : string speed : float Create a FigherPlane class that inherits from the Airplane class and adds the following attributes: numberOfMissiles : short
Question 33
Demonstrate a try-catch block for error handling. In the main method, get the number of kids for the person. If the person enters text (e.g., three), catch the exception, and tell the person about the error. Remember to reset the console input stream!
Question 34
Demonstrate composition. Create a HardDrive class with the following attributes. brand : string sizeInTB : float Create a Computer class with the following attributes. brand : string drive : HardDrive
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
