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

Username:   Password: 
 RegisterRegister   
 Accumulator Question + Counter
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
SucreTeen123




PostPosted: Fri Jun 01, 2012 3:19 pm   Post subject: Accumulator Question + Counter

Okay so my goal is to add prices together with 13% tax included in the toal bill and somehow include counter into it. But right now I am stuck on how to add them together properly. When I
try to add numbers together with the tax number it doesn't work properly. Please help!


%Calculating Page

var purchasecost : real
var taxmoney : real
taxmoney := 0
var total : real
total := 0
const tax := 0.13
var answer : string


loop
put "Please enter the cost of the item you wish to purchase"
put "Type in 0 to exit program"
get purchasecost

if purchasecost = 0 then
put "Are you sure (Y/N)"
get answer

exit when answer = "y" or answer = "Y"
end if

taxmoney := purchasecost * tax
total := taxmoney + purchasecost
end loop



put "The total cost for the CDs are ", total, " dollars."
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Jun 01, 2012 5:31 pm   Post subject: RE:Accumulator Question + Counter

in what way does it not work properly?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
SucreTeen123




PostPosted: Fri Jun 01, 2012 11:17 pm   Post subject: Re: Accumulator Question + Counter

It says that the values are not the same so I can't use it.
Tony




PostPosted: Sat Jun 02, 2012 1:51 am   Post subject: RE:Accumulator Question + Counter

So make values the same and use it.

Serious reply: what values? Not the same what, type? Provide line number of the problem and the actual error message.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: