Advertisement
teslariu

Integr2 sin excep

Feb 22nd, 2022
1,799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.83 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. """
  5. El dueño del comercio te cuenta las opciones que
  6. tienen. Solo 3 combos y un postre:
  7. Menú:
  8. ● Combo Simple (Hamburguesa simple + Bebida +
  9. Fritas) costo 5 usd
  10. ● Combo Doble (Hamburguesa doble + Bebida +
  11. Fritas) costo 6 usd
  12. ● Combo Triple (Hamburguesa Triple + Bebida +
  13. Fritas) costo 7 usd
  14. Postre:
  15. ● McFlurby (Helado de dulce de leche) costo 2 usd
  16. """
  17. import time
  18.  
  19. # Iniciamos la caja
  20. monto = 0
  21.  
  22.  
  23. print("Bienvenido a Hamburguesas IT")
  24. encargado = input("Ingrese su nombre encargad@: ")
  25. # registro el ingreso del encargado:
  26. try:
  27.     f = open("registro.txt", "x")
  28. except FileExistsError:
  29.     f = open("registro.txt", "a")
  30. # Ejemplo de registro
  31. # IN Sat Oct 23 10:18:18 2021 Encargad@ Gerardo
  32. f.write(f"IN {time.asctime()} Encargad@ {encargado}\n")
  33. f.close()
  34.  
  35.  
  36.  
  37. while True:
  38.     print("\nHamburguesas IT")
  39.     print(f"Encargad@ -> {encargado}")
  40.     print("Recuerda, siempre hay que recibir al cliente con una sonrisa :)")
  41.    
  42.     print("""
  43.         1 – Ingreso nuevo pedido
  44.         2 – Cambio de turno
  45.         3 – Apagar sistema
  46.     """)
  47.    
  48.     opcion = input("Seleccione una opción: ")
  49.    
  50.     if opcion == "1":
  51.         cliente = input("Ingrese nombre del cliente: ")
  52.         combo_S = int(input("Ingrese cantidad Combo S: "))
  53.         combo_D = int(input("Ingrese cantidad Combo D: "))
  54.         combo_T = int(input("Ingrese cantidad Combo T: "))
  55.         combo_Flurby = int(input("Ingrese cantidad Combo Flurby: "))
  56.        
  57.         total = combo_S * 5 + combo_D * 6 + combo_T * 7 + combo_Flurby * 2
  58.         print(f"Total: ${total}")
  59.         abona_con = int(input("Abona con $"))
  60.         print(f"Vuelto ${abona_con - total}")
  61.         pedido = input("¿Confirma pedido? Y/N: ")
  62.  
  63.         if pedido.upper() == "Y":
  64.             monto += total
  65.             try:
  66.                 f = open("ventas.txt", "x")
  67.             except FileExistsError:
  68.                 f = open("ventas.txt", "a")
  69.            
  70.             # Debo grabar los datos de la siguiente forma
  71.             # Juan , Sat Oct 23 10:18:18 2021 , 1 , 1 , 0 , 2 , 15
  72.             f.write(f"{cliente} {time.asctime()}, {combo_S}, {combo_D}, {combo_T}, {combo_Flurby}, {total}\n")
  73.             f.close()
  74.                
  75.  
  76.    
  77.     elif opcion == "2":
  78.         # antes de cambiar de encargado, cierro el anterior
  79.         f = open("registro.txt", "a")
  80.         # Ejemplo de registro
  81.         # OUT Sat Oct 23 18:23:18 2021 Encargad@ Gerardo $450
  82.         # ####################################################
  83.         f.write(f"OUT {time.asctime()} Encargad@ {encargado} ${monto}\n")
  84.         f.write(50 * "#" + "\n")
  85.                
  86.         print("Bienvenido a Hamburguesas IT")
  87.         encargado = input("Ingrese su nombre encargad@: ")
  88.  
  89.         # abro al nuevo encargado
  90.         f.write(f"IN {time.asctime()} Encargad@ {encargado}\n")
  91.         f.close()
  92.        
  93.        
  94.    
  95.     elif opcion == "3":
  96.         f = open("registro.txt", "a")
  97.         f.write(f"OUT {time.asctime()} Encargad@ {encargado} ${monto}\n")
  98.         f.write(50 * "#" + "\n")
  99.         f.close()
  100.         print("Apagando el sistema...")
  101.         break
  102.        
  103.     else:
  104.         print("Opción incorrecta...")
  105.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement