Skip to content

Instantly share code, notes, and snippets.

@renjithsraj
Created March 10, 2018 02:17
Show Gist options
  • Save renjithsraj/08fc429c7e9d6b04ed5eabd66345f0d8 to your computer and use it in GitHub Desktop.
Save renjithsraj/08fc429c7e9d6b04ed5eabd66345f0d8 to your computer and use it in GitHub Desktop.
import time
class Account:
def __init__(self):
self.style = {'1':"sporty", '2':"gimmick", '3':"casual", '4':"kpop", '5':"simple"}
self.price = {'1':5, '2':10, '3':15, '4':20, '5':25}
def stock(self):
stock = {'sporty':5,'gimmick':5,'casual':5,'kpop':5,'simple':5}
for digit in enter_quantity:
for styles in enter_item:
a = self.style[styles]
for a in stock:
b = int(stock[a])
if (b < digit):
print ("{} can't provide that quantity".format(self.style[styles]))
else:
stock_left = b - digit
# print (stock_left)
def getTotal(self,final_order):
cont = "true"
list_style = []
while cont == "true":
overAllTotal = 0
# for num in entity:
# list_style.append(self.style[num])
# overAllTotal = 0
# for digit in quantity:
# cost = self.price[num] * digit
# total = float(format(cost, '.2f'))
# overAllTotal += total
# cont = "true"
for item,quantity in final_order.items():
list_style.append(self.style[str(item)])
overAllTotal += float(self.price[str(item)] * quantity)
print ("Total Payment: "+str(overAllTotal)+" php")
count1 = "true"
while (count1 == "true"):
Cash = int(input("AMOUNT: "))
if (Cash >= overAllTotal):
change = float(format(Cash - overAllTotal, '.2f'))
print ("CHANGE: "+str(change)+"php")
count1 = "false"
elif (Cash < overAllTotal):
print ("Your money is not enough!")
count1 = "true"
print ("\nCustomer's Receipt\nOutfit Style\t\t:\t"+str(list_style)+'\n'+"Quantity of Purchase\t: \t"+str(quantity)+" pieces"+"\nTotal\t\t\t: \t"+str(overAllTotal)+" php"+"\nAmount\t\t\t: \t"+str(Cash)+"php""\nChange\t\t\t: \t"+str(change)+"php")
now = time.strftime("%c")
print (now)
print ("Thank you!\nCome again!")
cont = "false"
print ("\t\t\tFASHION APPAREL\n\t\twhere you can fit your suit!\t\t\n")
time.sleep(1)
print ("The following are the outfit that is available in one set.\nChoose the appropriate number of style.)")
print ("\tSTYLE\t\t\tPrice per Set\n"
"\t(1)SPORTY\t\t5.00php\n"
"\t(2)GIMMICK\t\t10.00php\n"
"\t(3)CASUAL\t\t15.00php\n"
"\t(4)KPOP\t\t\t20.00php\n"
"\t(5)SIMPLE\t\t25.0php")
count1 = "true"
enter_item = []
enter_quantity = []
while (count1 == "true"):
counter = "true"
while (counter == "true"):
try:
item = input("\nItem to purchase: ")
if (item == '1' or item == '2' or item == '3' or item == '4' or item == '5'):
are_sure = input("are you sure?(y/n): ")
if (are_sure.lower() == "y" or are_sure.lower() == "yes"):
enter_item.append(item)
print(enter_item)
counter = "false"
elif (are_sure.lower() == "n" or are_sure.lower() == "no"):
counter = "true"
else:
print("choose the number in the choices!")
counter = "true"
except ValueError:
print ("Please read the instruction!")
counter = "true"
counts = "true"
while (counts == "true"):
try:
quantity = int(input("how many set?: "))
if (quantity <= 0):
print ("below 0 is not acceptabe!")
counts = "true"
else:
counts = "false"
real_sure = input("are you sure?(y/n): ")
if (real_sure.lower() == "y" or real_sure.lower() == "yes"):
enter_quantity.append(quantity)
print(enter_quantity)
counts = "false"
elif (real_sure.lower() == "n" or real_sure.lower() == "no"):
counts = "true"
except ValueError:
print("it should be number!")
counts = "true"
order_again = input("do you want to order again?(y/n): ")
if (order_again.lower() == "y" or order_again.lower() == "yes"):
count1 = "true"
elif (order_again.lower() == "n" or order_again.lower() == "no"):
count1 = "false"
account1 = Account()
account1.stock()
final_order = dict(zip(enter_item, enter_quantity))
account1.getTotal(final_order)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment