Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

create a complete C++ program that prompts the user for a gross monthly pay amount, reads that amount from the keyboard, calculates the federal monthly

create a complete C++ program that prompts the user for a gross monthly pay amount, reads that amount from the keyboard, calculates the federal monthly tax withholding for that much pay, and prints the tax amount. The tax calculation shall be based on Table 4a (Single Person) found at the bottom of page 36 in IRS Publication 15 (Circular E) Employer's Tax Guide 2011.

Declare local variables of type double to hold values for the monthly gross pay amount and the monthly tax

Prompt the user (as shown below) for the monthly gross pay amount.

Enter monthly gross pay amount:

Read in the value entered by the user

Calculate the monthly tax by implementing the rules and calculations in Table 4a as a nested "if else" control structure. To do this, your source code should have the following basic format:

if ( conditional expression ) assignment statement containing calculations; else if ( conditional expression ) assignment statement containing calculations; else if ( conditional expression ) assignment statement containing calculations; else if ( conditional expression ) assignment statement containing calculations; else assignment statement containing calculations;

The number of "else if" lines is effected by the number of line in Table 4a.

Do not declare any constants to use in the "if else" control structure, or in this program overall, because it makes the calculations harder to validate in this case. Instead, just use the literal values from Table 4a

Represent all percent values in the "if else" control structure as decimal fractions. For example, use 0.10 for 10% instead of 10/100.

When displaying the result, print the phrase "Tax amount: " followed by the tax amount that your program calculated. .

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions