Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class StudentClass:
- #ATRIBUTOSS DE LAS CLASE
- matricula=""
- nombre=""
- telefono=""
- edad=""
- peso=0.0
- #METODOS
- def _init_(self, matricula, nombre):
- self.matricula=matricula
- self.nombre=nombre
- #Retorna cada dato, cada vez que acceda a ellos
- def getMatricula(self):
- return self.matricula
- def getNombre(self):
- return self.nombre
- def getTelefono(self):
- return self.telefono
- def getEdad(self):
- return self.edad
- def getPeso(self):
- return self.peso
- #Recibe informacion, para luego almacenarla
- def setNombre(self, nombre):
- self.nombre = nombre
- def setTelefono(self, telefono):
- self.telefono=telefono
- def setEdad(self, edad):
- self.edad = edad
- def setPeso(self, peso):
- self.peso = peso
- def obtenerdatos(self):
- while True:
- print("-----MENU-----\n")
- print("1. AGREGAR ESTUDIANTE")
- print("2. MODIFICAR DATOS")
- print("3. VER DATOS DEL ESTUDIANTE")
- print("4. SALIR")
- opcion = input("Selecciona una opcion: ")
- if(opcion=="1"):
- print("Escribe los datos del estudiante")
- a = input("Nombre: ")
- self.setNombre(a)
- b = input("Matricula: ")
- self.matricula = b
- elif(opcion=="2"):
- while(True):
- print("-----MENU PARA MODIFICAR-----\n")
- print("1. ACTUALIZAR TELEFONO")
- print("2. ACTUALIZAR EDAD")
- print("3. ACTUALIZAR PESO")
- print("4. REGRESAR AL MENU ANTERIOR")
- opcion2 = input("Selecciona una opcion: ")
- if(opcion2=="1"):
- c=input("Telefono:_")
- self.setTelefono(c)
- elif(opcion2=="2"):
- d = input("Edad:_")
- self.setEdad(d)
- elif(opcion2=="3"):
- e = input("Peso:_")
- self.setPeso(e)
- elif(opcion2=="4"):
- break;
- else:
- print("Opcion no valida")
- elif(opcion=="3"):
- print("DATOS DEL ESTUDIANTE: ")
- #print("Matricula: " + self.getMatricula())
- print("Nombre: " + self.getNombre())
- print("Matricula: " + self.getMatricula())
- print("Telefono: " + self.getEdad())
- print("Edad "+ self.getEdad())
- print("Peso: "+ self.getPeso())
- elif(opcion=="4"):
- self.obtenerdatos()
- else:
- print("Opcion no valida")
- a = StudentClass()
- a.obtenerdatos()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement