I always give a positive rating!
Language is C++
I know this looks really long, but this is actually
pretty easy.
Just follow the steps in the document below and paste
your code in the answer.
Thanks!
InClass 5 - 2016 Tax Calculations 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. 0 Learning Objectives Stepwise Relinement o Familiarity with writing complex expressions o Using if (and maybe switch) statements o using an if inside an if or o using an if inside a switch o Using constants. Make them ALL CAPS! More knowledge of data types. Always notice the data type of each variable. It is usually important and sometimes crucial. o Using a header file appropriately o the const definitions go in the header file o WARNING: never put varia or function definitions (except for inline or macro code) in a header files. You may not use functions (I know that isn't an Objective, but you will all notice this up here! Read the WHOLE assignment before you start writing code! Make your output match the assignment!!!!!!!!!!!!!!!!!!!!!!!!! o I suggest that once you have written the code and submitted your solution to Web-CAT, if you do not get a 100%, you should re-read the assignment. Details will suddenly pop out at you because then you will have thought a lot about the program and know details of what you did! 0 0 0 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 liling Jointly. Filing separate married, and Head of household. 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. 1
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 S2,725 is taxed at 15%. Tax is $1336.25. 0 ($9,275 * 0.10) - (($12,000 - $9,275) * 0.15) o $927.50 + $408.75 o S1336,25 2016 U.S. Federal Personal Tax Rates for Just Single Marginal Tax Rate Single 10% Up to $9,275 15% $9,276 - $37,650 25% $37,651 - $91,150 28% $91,151 - $190,150 33% $190.151 - $413,350 35% $413,351 - $415.050 39,6% $415,051 or more Use constants like in this expression: SINGLE 10*PER 10+ (SINGLE 15-SINGLE10)*PER15+ (SINGLE25-SINGLE15)*PER25 +(190150-91150)*PER 28 + (200000-190150)*PER33 = const int SINGLE 10 = 9275; const int SINGLE 15 = 37650; const int SINGLE 25 = 91150; = const double PER10 = 1; = You don't use the whole table for this in-class assignment. Here is the whole 2016 table that you will use for the Homework: Tax Ratte Single married Filing Jointly married Filing sep Ilead of Household 10% Up to $9,275 Up to $18,550 Up to 9,275 Up to $13,250 15% S9 276 - $37,650 $18,551 - $75 300 $9,276-$37,650 $13,251 - $50,400 25% $37,651 - $91,150 $75,301 - $151,900 $37.651-$75.950 $50,401 - $130,150 28% $91.151 - $190,150 $151.901 - S231,450 $75,951–S115,725 $130,151-5210,800 33% $190,151 - $413,350 $231,451 - 5413,350 $115,726—$206,675 $210.801-5413,350 35% $413,351 - $415,050 $413.351 - 5468,950 $206,8768233,475 $413,351-5441,000 39.6% S415,051 or more $486,951 or more $233,476 or more $441.001 or more 2
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: Filing Status Single 2016 $6,300 You need a constant for this: const int SID DED 6300; For example, from an input of S and 18300, you calculate the tax from the table above for 12000, ic. 18300 - 6300 = 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. Additional Requirements and Grading Notes 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. Plcasc remember: variables names start with lower casc; 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, eg. il your header file is called consts.h, then the top of your program should look like this: #include <iostream> #include "Conss." To submit this assignment, you need to zip together you *.cpp file and you h header file. I will cover how to do this in class. 3
All of these examples use the standard deduction shown above, so you subtract 6300 before you calculate the tax owed. Examples of 1/0 Piease enter your filing status Enter s for single flers, J for married ti ing Jointly, for married filing separately, or H for head o: household Status: S Please enter your income: 123456 Your Lax is $25340.13. Please notice the punctuation! Please enter your filing status Enter s for single flers, J for married fizing Jointly, for married tising separately, cr H for head o 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 otherwise) 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: 0 0 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 o Write the Calculations code in steps -- 1. Figure out how to do the calculation ONLY for Single, S8,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 iſ statement to separate the 2 tax brackets and test it) 4. then ligure 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) o Format your output to 2 decimal places, using fixed and setprecision() Create a variable for each piece of data you need, then prompt the user for that data and store it in your variables. 0 You may not use functions for this assignment. 0 4
Submit your program to Web-CAT An extensive set of tests will be run against your program, about 12. For example all of your prompts will be tested. Also each and every boundary between each tax bracket, e.g. 9275 and 9276 for Single. These 2 tests show that you have the calculation correct for 9275 al 10% and that the lax for 1 more dollar is 0.15 more, i.e. 927.65. This type of methodical testing is call Boundary Value Analysis. It will test all of your if statement Boolcan expressions as well as your calculations. 5
I always give a positive rating! Language is C++ I know this looks really long, but this is actually pretty easy. Just f
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
I always give a positive rating! Language is C++ I know this looks really long, but this is actually pretty easy. Just f
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!