Start with a template and fill in the information as stipulated by the requirements. I do not see requirements for storing the data, so each instance of Worker will just request input, print the calculated results, and quit.
public class Worker{
// state variables: (define attributes)
...
// constructor (from hours, rate)
...
// Methods
// accessors for each attribute
...
// compute method, returns total
...
public static void main(String[] args){
// A while loop to request input,
// create an instance of Worker
// output data and total
// terminate while-loop when hours and rate are 0
...
}
}
Write a program that inputs (from the user) the number of hours worked and hourly pay rate for employees and outputs their total pay. The program should process an arbitrary number of employees; the user will terminate input by entering 0 for hours worked and rate of pay. Use a class called Worker as follows:
Attributes: Hours, Rate, Total
Methods: ComputeTotal and access methods for each of the attributes
2 answers
Write a pseudocode to represent the logic of a program that allows a user to enter an hourly pay
rate and hours worked. The program outputs the user’s gross pay
rate and hours worked. The program outputs the user’s gross pay