Post a New Question

Oop programming

posted by on .

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

  • Java? - ,

    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
    ...
    }

    }

Answer This Question

First Name:
School Subject:
Answer:

Related Questions

More Related Questions

Post a New Question