Answered step by step
Verified Expert Solution
Link Copied!

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

imageimage

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Starting Out With Java From Control Structures Through Data Structures

Authors: Tony Gaddis

6th Edition

0133957055, 978-0133957051

More Books

Students also viewed these Programming questions

Question

What is overfitting? Why is it so important to watch out for?

Answered: 1 week ago

Question

Define Administration and Management

Answered: 1 week ago

Question

Define organisational structure

Answered: 1 week ago