Could someone help me with calculating hst im trying to figure out what i did wrong if someone could help thanks!
Author |
Message |
pattingman
|
Posted: Tue Apr 14, 2015 4:07 pm Post subject: Could someone help me with calculating hst im trying to figure out what i did wrong if someone could help thanks! |
|
|
What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>
What is the problem you are having?
Describe what you have tried to solve this problem
<Trying to figure out how to calculate hst which is 0.13 I keep trying but i cant seem to see whats wrong >
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<hst := price*0.13
total := price + hst
>
Turing: |
<Add your code here>
%Lets do this
%Declaration of variables
var hue : string
var bill : real
var price : int
var hst : real
var item_name : string
var total : real
%Input
put "Why hello there please choose what kind of program you would like to use!"
put "A)Bill"
put "B)Game"
get hue
if hue = "A" then
put "Alright you choose to do the bill!This will calculate the price of 1 item with tax!"
put "(In canadian dollars) please enter the name of your item!"
get item_name
put "Now the price of your item!"
get price
put "", item_name, " $", price
put "Hst $", hst
put "---------------------------"
put "Total $", total
end if
%Calculation
hst := price*0.13
total := price + hst
|
Please specify what version of Turing you are using
<4.1.1> |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Dreadnought
|
Posted: Tue Apr 14, 2015 4:25 pm Post subject: Re: Could someone help me with calculating hst im trying to figure out what i did wrong if someone could help thanks! |
|
|
You are trying to print the value of hst before you compute it. |
|
|
|
|
|
Tony
|
Posted: Tue Apr 14, 2015 4:27 pm Post subject: RE:Could someone help me with calculating hst im trying to figure out what i did wrong if someone could help thanks! |
|
|
Start at the top, go down one line at a time, and keep track of what's happening in the computer. When you get to the last line of
code: |
%Declaration of variables
var hue : string
var bill : real
var price : int
var hst : real
var item_name : string
var total : real
%Input
put "Why hello there please choose what kind of program you would like to use!"
put "A)Bill"
put "B)Game"
get hue
if hue = "A" then
put "Alright you choose to do the bill!This will calculate the price of 1 item with tax!"
put "(In canadian dollars) please enter the name of your item!"
get item_name
put "Now the price of your item!"
get price
put "", item_name, " $", price
put "Hst $", hst
|
What is the value held by variable hst? |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|
|