i need to convert this code to visual basic for a proyect that i did not know that was to be in viasual basic form and to be honest i don't have much time so if anyone can help me that could be amaizing
What I have tried:
def mostrarStock(listaJuegos):
print ()
print ("Juegos en stock")
if len(listaJuegos) != 0:
print ("Nombre: ", listaJuegos[0], " Cantidad: ",
listaJuegos.count(listaJuegos[0]))
else:
print ("No se encuentran juegos en stock")
i = 1
while i < len(listaJuegos):
listaJuegos.sort()
if listaJuegos[i] != listaJuegos[i - 1]:
print ("Nombre: ", listaJuegos[i], " Cantidad: ",
listaJuegos.count(listaJuegos[i]))
i += 1
def venderJuego(nombreJuego, listaJuegos, nombreComprador,
historialJuego, historialComprador):
historialComprador.append(nombreComprador)
historialJuego.append(nombreJuego)
listaJuegos.remove(nombreJuego)
print ("...")
print ("Juego vendido")
print ()
def gestionarDevolucion(nombreJuego, listaJuegos, nombreComprador,
historialJuego, historialComprador):
i = historialComprador.index(nombreComprador)
j = historialJuego.index(nombreJuego)
historialComprador.remove(historialComprador[i])
historialJuego.remove(historialJuego[j])
listaJuegos.append(nombreJuego)
print ("...")
print ("Juego devuelto a la tienda")
print ()
def historialCompras(historialJuego, historialComprador):
i = 0
print ()
print ("Historial de ventas realizadas")
while i < len(historialJuego):
print ("\nNombre: ", historialJuego[i], "\nComprador: ",
historialComprador[i])
i += 1
print ("\nCantidad de venta realizadas: ", (len(historialJuego)))
def anadirStock(listaJuegos, nombreJuego):
listaJuegos.append(nombreJuego)
print ("...")
print ("Juego anadido al stock")
print ()
def menuOpciones():
op = 0
while op != 1 and op != 2 and op != 3 and op != 4 and op != 5 and op != 6:
print ()
print (" ____________")
print ("|___MENU PRINCIPAL___|")
print ("| [1] Mostrar stock |")
print ("| [2] Vender juego |")
print ("| [3] Gestionar devolucion |")
print ("| [4] Ver historial de compras |")
print ("| [5] Anadir stock |")
print ("| [6] Salir |")
print ("|____________|")
op = int(input("Ingrese opcion: "))
return op
listaJuegos = ["Dark Souls", "Overwatch", "World of Warcraft", "Borderlands", "Minecraft", "Dark Souls", "Dark Souls", "Overwatch"]
historialJuego = []
historialComprador = []
op = menuOpciones()
while op != 6:
if op == 1:
mostrarStock(listaJuegos)
elif op == 2:
nombreJuego = input("Ingrese el nombre del juego: ")
nombreComprador = input("Ingrese el nombre del comprador: ")
venderJuego(nombreJuego, listaJuegos, nombreComprador,
historialJuego, historialComprador)
elif op == 3:
nombreJuego = input("Ingrese el nombre del juego a devolver: ")
nombreComprador = input("Ingrese el nombre del cliente: ")
gestionarDevolucion(nombreJuego, listaJuegos, nombreComprador,
historialJuego, historialComprador)
elif op == 4:
historialCompras(historialJuego, historialComprador)
elif op == 5:
nombreJuego = input("Ingrese el nombre del juego: ")
anadirStock(listaJuegos, nombreJuego)
op = menuOpciones()