Question: For C++ -- Write a pure abstract base class Bonus that has a pure abstract function calcBonus (double wages, double rate). -It has two protected

For C++ --

Write a pure abstract base class Bonus that has a pure abstract function calcBonus (double wages, double rate). -It has two protected member variables: double wages and double rate. -It has two mutator functions, void setWages(double w), and void setRate(double r), which set the values for wages and bonus rate. -Classes Regular and Overtime are derived from pure abstract class Bonus. --Class Regular calculates the bonus amount by taking one months wages and multiplying it by 0.50. The product is then multiplied by the bonus rate that is 30% of the product. --Class Overtime takes the wages and divides them by 40 (hours). It then asks for overtime hours and calculates the overtime amount by multiplying overtime hours with (1.5*wages/hours). It then adds the overtime amount to wages to calculate total of wages+overtime. It then multiplies this total by 0.50 and calculates bonus by multiplying the product with 30%.

Implement the pure abstract function calcBonus in the derived classes Regular and Overtime. Calculate and display in client program the bonus amount for an object of Regular class as well as an object of Overtime class.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!