Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Turing Cash Register Assignment. Help Needed
Author Message
Sarah.Cameron

Posted: Sun Oct 25, 2020 6:44 pm   Post subject: Turing Cash Register Assignment. Help Needed

What is it you are trying to achieve?
I have to create a Cash Register program

What is the problem you are having?
In the receipt of my cash register program, I have to include the name of the item the user wants and how many times they have ordered it, but i really dont know how to do it. help is really needed

Describe what you have tried to solve this problem
I tried using if statements and a counter, but i think im doing it wrong

Heres my code :
put "Welcome to the Cash Register!"
put "Enter in the password (case sensitive)"

loop
get pass

count := count +1
if pass = "ICS" or count = 3 then
exit
else
end if
end loop
if count = 3 and pass not= "ICS" then
else
put "Welcome to Cash Register at Alex's Burgers!"
put "How many meals will you be ordering today? (No more than 10 meals permitted)"
get meals

loop
if meals > 10 then
put "Invalid number of meals"
get meals
end if
if meals <=10 then

exit
end if
end loop

for i : 1 .. meals
put "* 1. Hamburger, \$9.95 *"
put "* 2. Cheeseburger, \$9.95 *"
put "* 3. Mega Burger, \$9.95 *"
put "* 4. Ultra Burger, \$9.95 *"
put "* 5. Ultimate Burger, \$9.95 *"
put "********************************"
put "What burger was ordered?"

put i, ": "..
get item

end for
end if

subtotal := meals * 9.95
taxcost := subtotal * TAXRATE
totalCost:= taxcost + subtotal

put "The order will cost \$", totalCost : 6:2 , " after taxes."
put "What was the amount of cash the customer paid in?"
get cash

loop

if cash < totalCost or cash > 200 then
put "Not enough cash was paid, or the maximum amount of payable cash was surpassed (Max \$200)"
get cash
end if

if cash = totalCost or cash <=200 and cash >totalCost then

put "*************RECEIPT**************"
put " "
put "Subtotal : \$ ", subtotal : 6:2
put "GST (13%) : \$ ", taxcost : 6:2
put repeat ("=", 35)
put "Total : \$ ", totalCost : 6:2
put "Cash : \$ ", cash : 6:2
change := cash - totalCost
put "Change : \$ ", change : 6:2
exit

end if

end loop

scholarlytutor

Posted: Fri Oct 30, 2020 10:54 am   Post subject: RE:Turing Cash Register Assignment. Help Needed

One problem I can see immediately is that the variable count has not been declared. Before your loop:

var count : int := 0

Note that I also initialized the variable to zero. This is necessary - you can't do count + 1 unless the variable already has a value. So that's why you make count start at zero.

So fix that first and let me know if you're having trouble with the other code.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 2 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: