Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this program, write a program that will act as a wage calculator for a single user. The program should use the number of hours

For this program, write a program that will act as a wage calculator for a single user. The program should use the number of hours worked and hourly wage to calculate

: Gross Pay

Deduction

Net Pay

The Gross Pay is the amount that the user is paid before any deductions are applied. The pay amount is based upon the number of hours worked. If the number of hours worked is less than or equal to 40, the gross pay is equal to number of hours worked times the hourly wage. If the number of hours worked is greater than 40, the gross pay is equal to the pay for the first 40 hours worked plus overtime pay, which is for any hour over 40 and is paid at 1.5 times the hourly wage for each hour over 40. The Deduction is based on the user's gross pay. If the gross pay is $100.00 or less, the deduction is 2% of the gross pay. If the gross pay is between $100.01 and $500.00, the deduction is 5% of the gross pay. If the gross pay is $500.01 or more, the deduction is 9% of the gross pay. The Net Pay is equal to the gross pay minus the deduction.

The basic logic for this program is still similar to what has been done in programs 1 and 2: the user is asked to enter values, calculations are performed, and the results of the calculations are displayed. The new concept is that different calculations will be performed based on values entered by the user. Ask the user for the number of hours worked. This is an integer value and must be placed into an integer variable. Ask the user for the hourly wage. This is a value that can contain a decimal point and must be placed into a float or double variable. Using a decision statement and the number of hours worked, calculate the gross pay using one of the two calculations described above. Using a cascading decision statement and the calculated gross pay, calculate the deduction amount using one of the three calculations described above. Calculate the net pay. Finally, display the wage information in a table. It should include the number of hours worked, hourly wage, gross pay, deduction, and net pay. The dollar amounts should be displayed with exactly 2 digits after the decimal point.

1. At the top of the C++ source code, include a documentation box that resembles the one from programs 1 and 2. This will be a part of every program that is submitted during the semester and this will be the last reminder in the program write-ups.

2. Include line documentation. There is no need to document every single line, but logical "chunks" of code should be preceded by a line or two that describes what the "chunk" of code does. This will also be a part of every program that is submitted for the remainder of the semester.

3. The dollar amounts should all be displayed with exactly 2 digits after the decimal point, including zeros.

4. Make sure to test the program with values other than the ones supplied in the sample output.

For up to 5 points of extra credit, add code that will display more of the calculated results. The extra results that should be displayed are:

The amount of pay without overtime

The number of hours paid without overtime

The amount of pay with overtime

The number of hours paid with overtime

The percentage of the deduction

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_2

Step: 3

blur-text-image_3

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

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions