
-----------------------------------
Sarah.Cameron
Sun Oct 25, 2020 6:44 pm

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 
    put "Invalid Password, Try Again" 
    end if 
end loop 
    if count = 3 and pass not= "ICS" then 
    put "Access Denied" 
    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  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 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
Fri Oct 30, 2020 10:54 am

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.
