Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
1.6 kB
3
Indexable
Never
import Student
import StudentService


class Console():

    def show_menu(self):

        print("Press 1 to show all students.")
        print("Press 2 to show student by ID.")
        print("Press 3 to add a new student.")
        print("Press 4 to update a student.")
        print("Press 5 to delete a student.")
        print("Press 6 for additional functions.")
        print("Press 7 to Exit the system.")


# console = Console()
# console.show_menu()

service = StudentService.StudentService()

student = Student.Student('Marta', 'Sommer')
student2 = Student.Student('Norbert', 'Mlynarski')
student3 = Student.Student('Izabela', 'Greszta')
student4 = Student.Student('Jakub', 'Rucki')
student5 = Student.Student('Angelina', 'Pawlarczyk')


service.add_student(student)
service.add_student(student2)
service.add_student(student3)
service.add_student(student4)
service.add_student(student5)


#service.show_students_list()


users_input = input("Choose a number between 1-7: ")

if users_input == '1':
    service.show_students_list()
elif users_input == '2':
    students_id = input("Type students' ID: ")
    service.show_student_by_id(students_id)
elif users_input == '3':
    new_student = Student.Student(input("Name: "), input("Surname: "))
    service.add_student(new_student)
elif users_input == '4':
    service.update_student(input("Student's ID: "), input("Student's updated name: "), input("Student's updated surname: "))
elif users_input == '5':
    service.delete_student(input("Type student's ID to remove: "))
elif users_input == '6':
    pass
elif users_input == '7':
    exit()

print('------------------')