Question: program to compute weekly pay for an employee. The program will prompt the user to enter the following: Employee Id Employee name Number of hours

program to compute weekly pay for an employee. The program will prompt the user to enter the following:

Employee Id

Employee name

Number of hours worked

Hourly rate The program will compute the weekly pay as follow: Weekly pay = hours worked x hourly rate

If the hours worked exceed 40 hours, the weekly pay will be calculated as follow: First 40 hours x hourly rate Subsequent hours x hourly rate x 2

Your program should consist of two classes as follow: class WeeklyPay Fourinstance variables to store the employee Id, name, hours worked Instance variables

Your program should consist of two classes as follow: class WeeklyPay Four instance variables to store the employee Id, name, hours worked Instance variables and hourly rate. Constructor Instance method Instance method You may declare additional instance variable(s) as you deem fit. The constructor will receive four parameters and initialise the instance variables accordingly. getPay Parameters: None Returns: Total pay of the week toString Parameters: None Returns: A descriptive String as shown in the program executions. XX YourName_Lab1 class Static method where XX is your tutoral class (e.g. T1, T2, etc) main Prompts user to enter employee Id, name, hours worked and hourly rate. Creates instance of WeeklyPay Calculates and prints the weekly pay.

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 Programming Questions!