Created
February 5, 2018 03:51
Revisions
-
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,119 @@ totalprice=0 totalitemcount=0 laborcharge=0 discount= 0 totalgccount=0 gcprice=0 tax=6.5 menuid=-1 loop do puts("Welcome to the CIT Cash Register (version 3.83))") puts(); puts("Menu Type\t\tMenu Item"); puts("----\t\t--------"); puts("1\t\tAdd Item Charge") puts("2\t\tAdd Labor Charge") puts("3\t\tApply Discount") puts("4\t\tApply Gift Card") puts("5\t\tTotal") puts("9\t\tNew Transaction") puts("0\t\tExit Application") puts("Enter the Menu ID") menutype=gets().to_i() #Get the menu type if (menutype == 1) puts ("Please enter a price amount") price = gets().to_f() price = price.round(2) if price > 0 totalprice= totalprice + price totalitemcount= totalitemcount + 1 end if (menutype ==2) if laborcharge > 0 puts ("The labor charge already exists") else puts ("Please enter a Labor charge") lc=gets().to_f() if lc > 0 laborcharge=lc.round(2) else puts("Labor charge must be greater than 0") end end end if (menutype ==3) if discount > 0 puts ("The discount already exists") else puts ("Please enter a discount amount of 5, 10 or 15") da=gets().to_i() if da == 5 or da == 10 or da == 15 discount=da else puts("discount must be 5, 10 or 15") end end end if (menutype == 4) puts ("Please enter how many GiftCards") gc = gets().to_f() gc = gc.round(2) if gc > 0 gcprice= gcprice + gc totalgccount= totalgccount + 1 end end if (menutype == 5) dcpercent=discount/100.0 totaldiscountamount=totalprice*dcpercent tax=0.065*(totalprice-totaldiscountamount) grandtotal=totalprice-totaldiscount+tax+laborcharge puts("description\tquanity\tamount") puts("items\t#{totalitemcount}\t#{totalprice}") puts("discount\t-#{discount}%\t-#{totaldiscountamount}") puts("tax\t6.5%\t#{tax}") if laborcharge > 0 labor=1 else labor=0 end puts("Labor\t#{labor}\t#{laborcharge}") puts("Grand Total\t\t#{grandtotal}") puts("Gift Card\t\t#{totalgccount}\t-#{gcprice}") if (grandtotal > gcprice) puts("Please pay amount: #{grandtotal-gcprice}") else puts("Remaining balance: #{gcprice-grandtotal}") end if (menutype == 9) totalprice=0 totalitemcount=0 laborcharge=0 discount= 0 giftCard=0 gcprice=0 totalgccount=0 gctotalprice=0 end end if (menutype == 0) puts("Thanks for using the cash register") end end end