# Project #1 Solution

\$30.00 \$24.90

Category:

## Description

Background:
This will be your first programming project in C++. Although most of the basic programming concepts are the same as those that you learned in CS 1400, you will have some syntax and structure differences to work through as you move from C# (or Java) to C++. This first programming assignment will give you a gentle introduction to programming in C++.

Objectives:
At the completion of this project, you will have created an application that properly uses C++ syntax and structure. In particular, this project

introduces students to the style and structure of a C++ program
uses the standard C++ I/O library to get input from the console,
uses arithmetic expressions, assignment, and control structures; and
uses arrays to store program data
uses the standard C++ I/O library to format output and send it to the console
Introduction:

Suppose that your state tax is computed using the following tables (Note all income amounts are in whole dollars):
Single or Married Filing Separate Returns
Taxable Income Subtract Tax Rate Add
\$0 to \$863 0 .023 0
\$864 to \$2,588 \$863 .033 \$25
\$2,589 to \$4,313 \$2,588 .052 \$85
over \$4,313 \$4,313 .075 181
Married Filing Joint Return
Taxable Income Subtract Tax Rate Add
\$0 to \$1,726 0 .023 0
\$1,727 to \$5,176 \$1,726 .033 \$40
\$5,177 to \$8,626 \$5,176 .052 \$175
over \$8,626 \$8,626 .075 390
For example, if a married person who earns \$5000.00 a year files a joint return the formula to calculate this person’s taxes would be

tax = ( (5000 – 1726) * 0.033 ) + 40.0

Project:

For this project, you should write a program that does the following:

Prompt the user to enter in their taxable income.
Get the input. Validate the input to insure that it is a positive value. You should not assume that a numerical value is entered. If the user enters non-numerical data your program should give the user an error message. Re-do this step if the input is not valid.
Prompt the user to enter in “s” or “m” for filing single or jointly.
Get the input and validate that it is either “s” or “m”. Re-do this step if the input is not valid.
Based on the user’s input, calculate the user’s tax using the appropriate tax table and display the amount of money that person owes. Present this data nicely formatted.
Ask the user if they want to do another tax calculation.
Accept either “y” or “n” as input. Validate the input and re-do this step if it is not correct.
If the user selects “y” start back at step one. If the user selects “n” quit. For all other choices, tell that user that an invalid choice was made and ask them to input again.
Format and document your code in accordance with the course style guidelines. Include a file prologue identifying you as the author. Submit your project using the instructions outlined in the Course Syllabus, Programming Projects section.

After you are satisfied that your program works correctly, submit it to Canvas as project #1. Create a zip file for this project and include the following:

The source code for your driver.
A screen shot of your execution results.

Description

Points possible

Source code files declare that you did not copy any code
Code meets style guidelines
Code is properly documented
5
Program prompts user to input a taxable income and then accepts input and validates that it is a valid positive number. If it is not valid, program prompts for another input.

5
Program prompts user to input an “s” or “m” to select the correct tax table and then accepts the input and validates that it is a legal choice. If it is not valid, program prompts for another input.

5
Program correctly calculates the Utah state tax based on the amount of taxable income and the tax table selected. Uses arrays to hold tax tables.

5
Program asks if another tax calculation is to be done and takes “n” or “y” as input. If “y” is selected, start again. Quit if “n” is selected. Otherwise ask for choice again.

5
Output is formatted so that that tax due always appears as a properly formatted currency value.

5
– Late penalty (-20% per day)

Total

30
Sample Output:

Problem 1 output