Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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