
Write a program that makes use of a class called Employee that will calculate an employee's weekly paycheque. Design your class based on the UML diagram to the right as well as the following notes:
A static field, empCount, keeps track of the number of instantiated employees and can be retrieved using the static method getCount( )
The constructor initializes the employee's name and employee number (a random number in the range of 1000 - 9999)
The method setEmployeePay( ) is overloaded to accomodate different payment methods based on empType:
Type 1 - Salaried employees have a yearly salary, paid on a weekly basis
Type 2 - Hourly employees are paid an hourly rate for the number of hours worked (overtime is time and a half for hours over 40)
Type 3 - Piece employees are paid a base amount plus $24.00 for every piece completed
The method calculatePay( )will determine what the employee's weekly pay is, based on their payment type
The methods getName( ) and getNumber( )return the employee's name and employee number respectively
All input & output should be displayed in the main class only
The main program should test your class by instantiating four different employees:
Test a salaried employee
Test two hourly employees, one who has worked overtime and one who hasn't
Test a piecework employee
The following data can be hard-coded into your program (no prompts to enter data other than the names):
Employee 1: (22.50, 35.0)
Employee 2: (45350.00)
Employee 3: (500.00, 25)
Employee 4: (14.75, 48.0)
Output:
Enter an employee name: Bob
Employee Count is: 1
Enter an employee name: Ted
Employee Count is: 2
Enter an employee name: Carol
Employee Count is: 3
Enter an employee name: Alice
Employee Count is: 4
Employee 8826 Bob earned $787.50
Employee 5454 Ted earned $872.12
Employee 1083 Carol earned $1100.00
Employee 8782 Alice earned $767.00

using these names

click on above line "using these names"