Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- """
- El dueño del comercio te cuenta las opciones que
- tienen. Solo 3 combos y un postre:
- Menú:
- ● Combo Simple (Hamburguesa simple + Bebida +
- Fritas) costo 5 usd
- ● Combo Doble (Hamburguesa doble + Bebida +
- Fritas) costo 6 usd
- ● Combo Triple (Hamburguesa Triple + Bebida +
- Fritas) costo 7 usd
- Postre:
- ● McFlurby (Helado de dulce de leche) costo 2 usd
- """
- import time
- # Iniciamos la caja
- monto = 0
- print("Bienvenido a Hamburguesas IT")
- encargado = input("Ingrese su nombre encargad@: ")
- # registro el ingreso del encargado:
- try:
- f = open("registro.txt", "x")
- except FileExistsError:
- f = open("registro.txt", "a")
- # Ejemplo de registro
- # IN Sat Oct 23 10:18:18 2021 Encargad@ Gerardo
- f.write(f"IN {time.asctime()} Encargad@ {encargado}\n")
- f.close()
- while True:
- print("\nHamburguesas IT")
- print(f"Encargad@ -> {encargado}")
- print("Recuerda, siempre hay que recibir al cliente con una sonrisa :)")
- print("""
- 1 – Ingreso nuevo pedido
- 2 – Cambio de turno
- 3 – Apagar sistema
- """)
- opcion = input("Seleccione una opción: ")
- if opcion == "1":
- cliente = input("Ingrese nombre del cliente: ")
- combo_S = int(input("Ingrese cantidad Combo S: "))
- combo_D = int(input("Ingrese cantidad Combo D: "))
- combo_T = int(input("Ingrese cantidad Combo T: "))
- combo_Flurby = int(input("Ingrese cantidad Combo Flurby: "))
- total = combo_S * 5 + combo_D * 6 + combo_T * 7 + combo_Flurby * 2
- print(f"Total: ${total}")
- abona_con = int(input("Abona con $"))
- print(f"Vuelto ${abona_con - total}")
- pedido = input("¿Confirma pedido? Y/N: ")
- if pedido.upper() == "Y":
- monto += total
- try:
- f = open("ventas.txt", "x")
- except FileExistsError:
- f = open("ventas.txt", "a")
- # Debo grabar los datos de la siguiente forma
- # Juan , Sat Oct 23 10:18:18 2021 , 1 , 1 , 0 , 2 , 15
- f.write(f"{cliente} {time.asctime()}, {combo_S}, {combo_D}, {combo_T}, {combo_Flurby}, {total}\n")
- f.close()
- elif opcion == "2":
- # antes de cambiar de encargado, cierro el anterior
- f = open("registro.txt", "a")
- # Ejemplo de registro
- # OUT Sat Oct 23 18:23:18 2021 Encargad@ Gerardo $450
- # ####################################################
- f.write(f"OUT {time.asctime()} Encargad@ {encargado} ${monto}\n")
- f.write(50 * "#" + "\n")
- print("Bienvenido a Hamburguesas IT")
- encargado = input("Ingrese su nombre encargad@: ")
- # abro al nuevo encargado
- f.write(f"IN {time.asctime()} Encargad@ {encargado}\n")
- f.close()
- elif opcion == "3":
- f = open("registro.txt", "a")
- f.write(f"OUT {time.asctime()} Encargad@ {encargado} ${monto}\n")
- f.write(50 * "#" + "\n")
- f.close()
- print("Apagando el sistema...")
- break
- else:
- print("Opción incorrecta...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement