Question: Please solve the java program For this assignment you will create a program that determines the weekly gross pay for three separate types of employees
Please solve the java program
For this assignment you will create a program that determines the weekly gross pay for three
separate types of employees HourlyEmp SalaryEmp, and CommEmp Name the project
firstNameProgramreplace firstName with your first name The package name should be
your lastName in lowercase letters, followed by a period and your first initial also lowercase
ie thomas.h The main should be called Program
You will have three classes HourlyEmp, SalaryEmp, and CommEmp. All three classes should
have string variables input may include spaces for firstName, lastName, and idNumber. All
three classes should also have a double variable for weeklyPay. The three classes must have a
getWeeklyPay method that returns the calculated value weeklyPay. There should NOT be a
method called setWeeklyPay weeklyPay is calculated based on the type of employee it is not a
value entered by the user
Hourly employees are paid based on the number of hours worked, the hourly pay rate and any
overtime over hours is usually paid at time and a half or double time. The information
should all be obtained from the user. Salary employees are paid at a rate of of their annual
pay. Commission employees are paid at of their gross sales for the week. The math
should take place inside of the getWeeklyPay method in the classes. The method will return the
result of the calculation when it is called from the main program.
The HourlyEmp class should also have double variables for hourlyPay, hoursWorked, and
otRate and an integer constant called HOURS The SalaryEmp class should have the three
String variables as well as a double variable for salary and an integer constant called WEEKS
Finally, the CommEmp class should have a double variable called grossSales and a double
constant called COMMRATE in addition to the three String variables. Create the
appropriate set and get also called mutator and accessor methods for the class variables a
constant should not have set or get methods
Your program will display a menu allowing the user to choose between the three types of
employees or exit. The program must repeat until the user enters four, then it should exit. See
below for an example:
Enter for an Hourly Employee:
Enter for a Salary Employee:
Enter for a Commission Employee:
Enter to Exit:
Your program should use a while loop to allow the user to keep entering choices until the users
choice equals If the user makes an incorrect entry for choice, the program should tell the
user that they made an incorrect entry and allow the user to try again. When the user enters a
choice in the correct range a whole number between and the program should ask for the
first name, last name, and id number. The program should not allow the user to continue until
they enter a choice in the correct range, a whole number between and
The program should ask for the additional information needed based upon which employee
type the user chose. Use a switch int choice and case statements for the menu choice. For
example, if the user enters a choice of the program should also ask for employees hourly rate
of pay hourlyPay the number of hours worked hoursworked and the rate of overtime pay
ie or called otRate
For all the double variables used in the program, while the user enters a number that is equal to
zero or less, your program should tell the user that they entered an incorrect number, and they
need to enter a number greater than zero. Then allow them the chance to enter another
number. Again, the user should not be allowed to continue until they enter a number greater
than zero. You must be sure that all the display of decimals are limited to two.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
