Social Icons

miércoles, 18 de septiembre de 2019

Super Mercado en Python

class Almacen: def __init__(self): self.__productos=[] #self.cant_existencia=float(0.00) #self.costo_compra=float(0.00) #self.precio_venta=float(0.00) #self.marca=str('') #self.descripcion=str('') def ValidacionEntero(self): correcto=False opc=0 while(not correcto): try: opc=int(input("Ingresa la opción: ")) correcto=True except ValueError: print("La opción es incorrecta...!") return opc def menuPrincipal(self): opcion=0 while True: if opcion!=8: print("\t\t Menu Principal ") print("\t\t 1.Añadir producto al almacen") print("\t\t 2.Mostrar productos") print("\t\t 8.Salir") opcion=self.ValidacionEntero() return opcion def mostrarProductos(self): if len(self.__productos)>0: for producto in self.__productos: producto.imprimirDatos() else: print("No hay productos registrados") def menuProductos(self): print("\t\t Menu Productos ") print("\t\t=======================") print("\t\t 1. Articulo") print("\t\t 6.Salir") opcion=self.ValidacionEntero() return opcion def agregarProducto(self): while True: seleccion=self.menuProductos() ################Articulo if seleccion == 1: producto=Almacen() producto.ingresarDatos() self.__productos.append(producto) print("Producto agregado al sistema:"+str(len(self.__productos))) elif seleccion==6: break def main(self): print("\t\t------ Supermercado Popular------") res='s' opcion=0 while True: opcion=self.menuPrincipal() if opcion==1: self.agregarProducto() elif opcion==2: self.mostrarProductos() if opcion==1 or opcion==8: print("Opcion Invalida") elif opcion == 8 : break def ingresarDatos(self): costo_compra=input("Costo de compra:") self.costo_compra=float(costo_compra) precio_venta=input("Precio de venta:") self.precio_venta=float(precio_venta) cant=int(input("Cantidad en existencia:")) self.cant_existencia=int(cant) marca=input("Marca del enlatado:") self.marca=str(marca) descripcion=input("Descripcion:") self.descripcion=str(descripcion) def imprimirDatos(self): print("|Costo: ",self.costo_compra,"|Precio: ",self.precio_venta,"|Cantidad: ",self.cant_existencia,"|Precio Venta: ",self.precio_venta,"|Descipción: ",self.descripcion) if __name__=="__main__": almacen=Almacen() almacen.main()

No hay comentarios.:

Publicar un comentario

PELICULAS PARA VER

  Inexactitudes fácticas en las películas (msn.com) https://www.msn.com/es-co/entretenimiento/famosos/inexactitudes-f%C3%A1cticas-en-las-pel...

 
 
Blogger Templates