![]() |
|
#1
|
|||
|
|||
C++ to figure TaxesI've got a coding project to take user input on income and calculate income tax based on that. For Example Married filing Jointly income of $70,000 yields a total tax of $10,615
It's broken down like first 15,100 is charged 10% tax so 15,100 * .01 = $1510 15,101 to 61,300 is charged 15% tax so 46200 *.15 = $6930 61,301 to 70,000 is charged 25% tax so 8700 *.25 - $2175 I'm sort of stumped on how to figure the taxes based on the range... If it was a flat tax rate say 25% if you make 70,000 i'd be a no brainer, but in this case each chunk of the income may fall into a different rate up to the total of 70000 as in the example. Anyone have some tips on how to handle that? |
|
#2
|
|||
|
|||
Re: C++ to figure TaxesQuote:
Pretend you are taking a test (no computers allowed, but non-programmable calculators that add, subtract, multiply and divide are allowed). Calculate taxes for the following: 1. Total income is 12,345.67 2. Total income is 34,567.90 3. Total income is 67,890.12 Show your work. Regards, Dave |
|
#3
|
|||
|
|||
Re: C++ to figure TaxesI was trying to think... take the user input for income say income_Varible
Then something like if income_Variable < top range of income level 1 then incometax = income_Variable * tax_rate for level 1 If income_Variable > income level 1 then take the difference (income_Variable - top amount income level 1) * tax_rate for level 1 But I'm not sure if I am over complicating the issue.... I'm a beginner C++ |
|
#4
|
|||
|
|||
Re: C++ to figure TaxesQuote:
That's why I suggested that you work it out with pencil and paper. Don't worry about C++ or variables or any blooming thing else. Do the calculations. Now, the steps in a computer program may not be exactly the same as with pencil and paper, but if you can't go to the trouble to go through some examples, I can't see any way on this beautiful green earth that you could expect to write a program to do it. (Also, how would you test the program to see if it is correct if you don't have some examples for which you know the answer?) Here is how I might do it with pencil and paper: Code:
Regards, Dave |
Recent GIDBlog
Flickr uploads of IA pictures by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| bodybuilding and figure | Marilia05 | Sports Forum | 3 | 30-Oct-2006 21:30 |
| can't figure this out (classes cross referencing) | ehudros | C++ Forum | 4 | 12-May-2006 09:29 |
| Need Help Modifying Code | sosy2001 | C Programming Language | 10 | 17-Nov-2004 07:07 |
| NOT sure what is wrong with script fscanf | jenmaz | C Programming Language | 14 | 29-Oct-2004 14:53 |
| Can't figure out errors | crystalattice | C++ Forum | 3 | 17-Jul-2004 07:58 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The