Posted: October 2nd, 2022
In earlier chapters you developed classes needed for Cost Is No Object—a car rental service that specializes in lending antique and luxury cars to clients on a short-term basis. The rental service produces computerized paychecks for its employees every week. Write a program that gets data for each of the following:
An employee ID number
A first name
A last name
A street address
A zip code
An hourly pay rate
Number of hours worked this week
An insurance plan code
Create an application that prompts the user for employee data; the application continues to accept data for new employees until the user enters 0 for an ID number to indicate the desire to quit. While the ID number is not zero, prompt the user for a value for each field in turn. Any time the user enters an invalid value, continue to reprompt the user for the same data. Continue with the next data item only when the previous item is valid, as follows:
An employee ID must be between 100 and 999 inclusive.
A zip code must not be greater than 99999.
An hourly pay rate must be between $6.00 and $25.00 inclusive.
The number of hours worked in a week cannot be negative or more than 70.
An insurance plan code must be 1 or 2.
When all the needed data has been entered correctly for an employee, display a copy of all the data fields for the employee as well as the following:
Gross pay, calculated as hours worked times pay rate
Income tax, which is calculated as 15% of the gross pay if the gross pay is $400 or less; otherwise, it is 20% of the gross pay
Insurance premium, which is $60 for insurance plan code 1 and $100 for insurance plan code 2
Net pay, which is calculated as gross pay minus income tax, minus insurance premium; if the net pay is negative (the employee did not earn enough to cover the tax and insurance), then the net pay should be $0
Place an order in 3 easy steps. Takes less than 5 mins.