Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 please help me with federal income tax problem
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Misha




PostPosted: Mon Oct 04, 2004 7:31 pm   Post subject: 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
Sponsor
Sponsor
Sponsor
sponsor
AsianSensation




PostPosted: Mon Oct 04, 2004 7:35 pm   Post subject: (No subject)

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




PostPosted: Mon Oct 04, 2004 7:53 pm   Post subject: (No subject)

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 >27000 then
money * 0.17
end if
if money >54500


thanx
AsianSensation




PostPosted: Mon Oct 04, 2004 8:05 pm   Post subject: (No subject)

well, you are doing something like
code:
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

code:
money * 0.17
, it should be
code:
Taxes := money * 0.17
Paul




PostPosted: Mon Oct 04, 2004 8:10 pm   Post subject: (No subject)

its money+money*taxrate
Misha




PostPosted: Mon Oct 04, 2004 8:30 pm   Post subject: (No subject)

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
if money >27000 then
taxes := money * 0.17
end if


please help
thanx
wtd




PostPosted: Mon Oct 04, 2004 8:31 pm   Post subject: (No subject)

code:
if money <= 27000 then
   money * 0.17
end if
if money >27000 then
   money * 0.17
end if


This should be:

code:
if money <= 27000 then
   money * 0.17
elsif 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




PostPosted: Mon Oct 04, 2004 8:33 pm   Post subject: (No subject)

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:

code:
put "You need to pay", taxes, " amount of money"
Sponsor
Sponsor
Sponsor
sponsor
Misha




PostPosted: Mon Oct 04, 2004 8:47 pm   Post subject: (No subject)

sorry again, but this program isn't still finished and i tryed finishing it but it keeps screwing up.

please help

thanx
Paul




PostPosted: Mon Oct 04, 2004 9:25 pm   Post subject: (No subject)

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




PostPosted: Mon Oct 04, 2004 9:42 pm   Post subject: (No subject)

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




PostPosted: Tue Oct 05, 2004 5:32 pm   Post subject: (No subject)

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




PostPosted: Tue Oct 05, 2004 5:34 pm   Post subject: (No subject)

Misha wrote:
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 Razz
but if by helping you mean posting code for you Confused then I suppose I didn't
henry89




PostPosted: Sat Dec 08, 2018 1:39 pm   Post subject: Re: please help me with federal income tax problem

Hello,


Misha wrote:

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 >27000 then
money * 0.17
end if
if money >54500


thanx


Thanks for creating a program for income tax calculate that I have uses this code & this code is very useful.

Thanks again!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 14 Posts ]
Jump to:   


Style:  
Search: