Computer Science Canada

program

Author:  Mrs A [ Mon Jun 16, 2003 12:06 pm ]
Post subject:  program

Does anyone know how to run a rpogram that gets a program to enter the amt of egg's/onions they want. then with the price being 3.5 and 2.00 ...then output the total? im alil confused on how i get the total and the prices to collaborate

Author:  skatelhs [ Mon Jun 16, 2003 12:11 pm ]
Post subject:  heehee mrs. a

%Eggs and Onions!
%By Adam Skelly
%June 16th, 2nd last day of school! Smile
var eggs : int
var onions : int
var choice : string
eggs := 0 %shows that you start out having bought 0 dozen eggs
onions := 0%shows that you start out having bought 0 bags of onions
loop
put "What would you like to buy? A dozen eggs, or a bag of onions? Type leave to stop."
get choice %Gets the choice from customer
if choice = "eggs" then
eggs := eggs + 1 %If eggs are chosen, var eggs becomes = to eggs plus one
put "You have bought ", eggs, " dozen eggs, which comes to $", eggs * 2
put "You have bought ", onions, " bags of onions, which comes to $", onions * 3.5
put "Your total is $", (eggs * 2 + onions * 3.50) %Displays how much it costs
put " " %gives a space
else
if choice = "onions" then
onions := onions + 1 %If onions are chosen, onions becomes = to onions plus 1
else
quit %If anything other than onions or eggs are chosen, the program quits

end if
theres your answer, mrs a... lol

Author:  skatelhs [ Mon Jun 16, 2003 12:12 pm ]
Post subject: 

MRS VAGEON IS A STUPID WHORE, AS IVE SAID BEFORE

Author:  Asok [ Mon Jun 16, 2003 1:32 pm ]
Post subject: 

locked. You know why.


: