Anonymous asked in Computers & InternetProgramming & Design · 1 decade ago

making the following program for running in c++?

A company pay its employees as follows

~ hourly workers(who receive a fixed hourly wages for up to the first 40 hours they worked and "time-and-a-half" i.e., 1.5 time their hourly wages,for overtime hours worked),

~commission workeds(woh receive $250 plus 5.7% ofthir gross weekly sales),

~pieceworker(who received a fixed amount of money per item for each of rhe items they produce-each pieceworker in this company works on only one type of item).

write a programme to compute the weekeiy pay for each do not know the number of employee in advance.

each type of employee has its own pay code;

1-hourly workers

2-commission workers


use a switch to compute each employee pay based on that employee paycode.within the switch, prompt the (i.e., the payrol clerk) to the apporiate fact program need to calculate each employee pay based on the employee paycode??


1 Answer

  • 1 decade ago
    Favorite Answer

    Create a class that has the private attributes of:

    - employee_type (type should be "int" to make it easiest)

    - id (string most likely ... this could be an SSN for example)

    - employee_name (string type)

    - rate (double or float type)

    Then, you can prompt for the information and fill in the class as necessary. The class should have the variables defined as private and include get/set functions (i.e. "setName(string theName)").

    The class should have a function called something like "calculatePay()", which would return a double (or float) that was the value as computed based on the specifications above.

    And since it's a class you can allocate/deallocate it as necessary to clear out the memory used by the application.

Still have questions? Get your answers by asking now.