Question
Write a complete, working C++ program called that does the following: Compute bonus based on salary and experience of an employee. Declare an enumeration constant
Write a complete, working C++ program called that does the following:
Compute bonus based on salary and experience of an employee.
-
Declare an enumeration constant that can take two types of experience levels High,and Low. Assign characters H, and L respectively to the data items.
-
Declare two double variables one for the salary and the other for the bonus of the employee.
-
Declare a character variable named answer.
-
Declare a character variable named choice. This character variable will represent one of
the two experience levels of your enumeration data.
-
Using cin and cout statements, prompt the user to enter the salary of the employee.
-
Using cin and cout statements, prompt the user to enter an appropriate value for
variable choice to select the experience level. The user may choose to enter the character
in either uppercase or lowercase but your program must work for either case.
-
Design a switch-case block with a default case using your character variable choice as the
switching expression. Your statements must have the enumeration constants -- High, andLow-- as the case constants.
o For High case: The bonus is 5% of the salary.
o For Low case: The bonus is a seeded random number between 1000 and 2000, inclusive.
o Use the default case to inform the user if the user makes the wrong selection of experience level. The bonus is 0 for default case.
-
Display the bonus as well as total pay of the employee using suitable messages.o Total pay is the sum of the salary and the bonus of the employee. o You must display 2 decimal numbers after the decimal point.
-
Ask the user if another employee needs to be processed using the variable answer.
o The user may enter the value for answer in either uppercase or lowercase, but
your program must work for either case. o If the user decides to process another employee, use a loop to ask the user for the
salary and the experience for a new employee and compute the bonus again. o Your loop must keep on repeating until the user decides to stop processing more
employees. o You must use a Boolean variable to control this loop.
Due to time constraints, no comments are required in this code.
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