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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started