
-----------------------------------
Misha
Mon Oct 04, 2004 7:31 pm

please help me with federal income tax problem
-----------------------------------
hi, i am new to turing and i need help with an easy question. my teacher assigned us a problem that goes like this

Write a program to calculate the amount of Federal Income Tax owed by the user.  Federal Income Tax is calculated the following way:  If you earn less than $27000 you pay 17% of your income.  If you earn between $27000 and $54500 then you pay 17% on the first $27000 and then 24% on the amount over $27000.  If you earn more than $54500 then you pay 17% on the first $27000, 24% on the next $27500 and 29% on the amount over $54500.

please help
thanx

-----------------------------------
AsianSensation
Mon Oct 04, 2004 7:35 pm


-----------------------------------
well, please show me what you have done so far, it's not our habit to give out free code and such.

I do suggest the usage of case or if statements, they are very helpful for this problem.

Also it helps if you know some basic math. Such as 17% of something is the same as multiplying by 0.17.

-----------------------------------
Misha
Mon Oct 04, 2004 7:53 pm


-----------------------------------
this is what i have so far but i don't know if it is right because it keeps saying error and since i'm new to turing i don't understand why. as well if you tell me why please do it the easy way because we didn't learn the hard way and are teacher doesn't want us to do that.

[code]

%------------------------------------------
% federal tax
% Date Written Oct 4 
% 
% input: how much money the user earn
% output: amount of money user has to pay for federal income tax
% Process: ask user how much money the user makes
%-----------------------------------------

% Declare Variables
var money : real

% Ask for input
put "how much money do you make a year? "
get money
if money 27000 then
money * 0.17
end if
if money >54500
[/code]

thanx

-----------------------------------
AsianSensation
Mon Oct 04, 2004 8:05 pm


-----------------------------------
well, you are doing something like money * 0.17, which yields a value only. You need something to hold this value. 

So you could declare another variable, and call it Taxes, and make it real. Then, you assign Taxes your calculated value. 

So instead of 

money * 0.17, it should be Taxes := money * 0.17

-----------------------------------
Paul
Mon Oct 04, 2004 8:10 pm


-----------------------------------
its money+money*taxrate

-----------------------------------
Misha
Mon Oct 04, 2004 8:30 pm


-----------------------------------
okay i did wat you told me but the program doesn't do anything and i said that i don't know how to do any of the other stuff. this is wat i have
[code]
%------------------------------------------
% federal tax
% Date Written Oct 4 
% 
% input: how much money the user earn
% output: amount of money user has to pay for federal income tax
% Process: ask user how much money the user makes
%-----------------------------------------

% Declare Variables
var money : real
var taxes : real

% Ask for input
put "how much money do you make a year? "
get money
if money 27000 then
taxes := money * 0.17
end if
[/code]

please help
thanx

-----------------------------------
wtd
Mon Oct 04, 2004 8:31 pm


-----------------------------------
if money 27000 then
   money * 0.17
end if

This should be:

if money 27000 then
   money * 0.17
end if

The way you have it written, both would have been run.  When you use "else" and "elsif", you ensure that only one possibility can be judged true.

-----------------------------------
AsianSensation
Mon Oct 04, 2004 8:33 pm


-----------------------------------
well, you are kinda missing a couple of put statements. How are you expecting outputs on the screen if you do not use put to output your results?

do something like this:

put "You need to pay", taxes, " amount of money"

-----------------------------------
Misha
Mon Oct 04, 2004 8:47 pm


-----------------------------------
sorry again, but this program isn't still finished and i tryed finishing it but it keeps screwing up.

please help

thanx

-----------------------------------
Paul
Mon Oct 04, 2004 9:25 pm


-----------------------------------
and you don't have to say "I'm new to turing" everytime you ask for help, its not as if we won't help you if you don't say that.

-----------------------------------
Misha
Mon Oct 04, 2004 9:42 pm


-----------------------------------
i am new to turing and i say that because when i don't say it people give me these hard codes that i don't understand. anyways you didn't help me, so please do.

-----------------------------------
Cervantes
Tue Oct 05, 2004 5:32 pm


-----------------------------------
A wee bit aggressive in our asking for help, are we?

You outlined the way taxes work very nicely.  Now, using two variables, one for the persons income and another for the amount of tax they owe, write the code.  Use if statements, and simply follow what the question is.  Use logic, and you'll be fine.

If you still have problems, show us the revised code, not the code you posted at first.

-----------------------------------
Paul
Tue Oct 05, 2004 5:34 pm


-----------------------------------
i am new to turing and i say that because when i don't say it people give me these hard codes that i don't understand. anyways you didn't help me, so please do.
actually, I did post above, AS just got there b4 me :P
but if by helping you mean posting code for you  :? then I suppose I didn't

-----------------------------------
henry89
Sat Dec 08, 2018 1:39 pm

Re: please help me with federal income tax problem
-----------------------------------
Hello,



this is what i have so far but i don't know if it is right because it keeps saying error and since i'm new to turing i don't understand why. as well if you tell me why please do it the easy way because we didn't learn the hard way and are teacher doesn't want us to do that.



Thanks for creating a program for income tax calculate that I have uses this code & this code is very useful. 

Thanks again!
