Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Goal In this programming project, you will be writing an application to calculate the taxes for the year 2016 for an individual based on

C++
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Goal In this programming project, you will be writing an application to calculate the taxes for the year 2016 for an individual based on their income and filing status. This in-class assignment is a part of the Homework assignment too. For this assignment you only have to code the Single taxpayers taxes. Program Features When your program starts, the user is prompted for a single letter indicating their filing status, and the amount of income the user has made that year. There are 4 statuses: Single, married filing Jointly, Filing separate married, and Head of houschold. For this assignment, you are only handling the code for status Single, but you must still read in the S for Single. The table below shows the rates for 2016, and the following examples show how the tax is calculated so that you can derive the formula. This table is for the taxable income. You must subtract the standard deduction before calculating the tax. The Single Standard Deduction is given below. You must declare the filing status as a char and the income as an int. For example: For someone Single with a taxable income of $12,000 (18300 entered for income). the first $9,275 is taxed at 10% and the remaining $2,725 is taxed at 15%. Tax is $1336.25. o ($9,2750.10)+(($12,000$9,275)0.15) o $927.50+$408.75 - $1336.25 Use constants like in this expression: SINGLE10*PER10 + (SINGLE15-SINGLE10)*PER15 + (SINGLE25-SINGLE15)*PER25 +(19015091150) PER28 +(200000190150) PER33 const int SINGLE10 =9275 const int SINGLE15 =37650 const int SINGLE25 =91150; const double PER10 =.1 You don't use the whole table for this in-class assignment. Your program should prompt the user to enter the filing status and income, and from that income value your program should subtract the Standard Deduction and compute the owed tax. Although the statuses use S,J,F, and H as input for the status, you only need to write code to accept S for Single. Here is the Standard Deduction for just Single: You need a constant for this: const int STD_DED =6300 For example, from an input of S and 18300 , you calculate the tax from th table above for 12000 , i.e. 183006300=12000. The tax is $1336.25 as shown above. Additional examples are given below. The Standard Deduction should be hard coded using a constant literal. You must use a const for the standard deduction and all of the constants. You must use a int for the income variable that you use. You will get rounding differences (slightly different values than web-CAT is expecting) in your income tax values if you use float or double. You must use double for the owed tax. 1) You must use constants for all of the fixed numbers (the percentages and the numbers from the above table) in your program. These constants must be used inside your if conditions and inside your calculations in your code. You may not have numbers inside your calculations. You must come up with a reasonable naming scheme, use meaningful identifier names (for all of your constants and variables!), and use proper case conventions in your names. Please remember: variables names start with lower case; classes and structs (which we have not covered) start with capital letters; constants are in ALL CAPS. 2) You should put your constants in a separate header file and include it at the top of your program, e.g. if your header file is called consts.h, then the top of your program should look like this: \#include iostream \#include "consts.h" Examples of I/O Please enter your filing status All of these examples use the Enter S for Single filers, standard deduction shown above, so J for married filing Jointly, you subtract 6300 before you F for married Filing separately, or H for head of household calculate the tax owed. Status: S Please notice the punctuation! Please enter your income: 123456 Your tax is $25840.43. Please enter your filing status Enter S for single filers, J for married filing Jointly, F for married Filing separately, or H for head of household Status: S Please enter your income: 15576 Your tax is $927.65. Developing the Program One technique that is helpful in solving problems (whether they are programming problems or othervise) is decomposition: breaking the problem into smaller and manageable pieces. With a program like this, you need a place to collect solutions to those pieces. A natural strategy in object-oriented programming is to create a new class. In this project you are only required to use one class, but must use various methods to solve different pieces of the problem. This technique of writing methods to solve pieces of the problem is known as "Stepwise Refinement." Here are some helpful hints: - Make sure you understand how a single calculation is done by doing several by hand! - Use "Stepwise Refinement" and decompose the problem (like the comments I have used) 1. Input 2. Calculations 3. Output - Write the Calculations code in steps -- 1. Figure out how to do the calculation ONLY for Single, $8,000 and write the code (and test it) 2. then figure out the calculation for Single, $10,000 (and test it) 3. then add one if statement to separate the 2 tax brackets (and test it) 4. then figure out the calculation for Single, $40,000 (and test it) 5. then add if statements for more of the tax levels/brackets. (and test it) - Format your output to 2 decimal places, using fixed and setprecision0 - Create a variable for each piece of data you need, then prompt the user for that data and store it in your variables. - You may not use functions for this assignment

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

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

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions

Question

10-9 How have social technologies changed e-commerce?

Answered: 1 week ago