Programming Project
Programming Project
def print_account_details(self):
print("Account Details:")
print("Name:", self.name)
print("NationalID:", self.__NID)
print("Phone:", self.phone)
print("Faculty:", self.faculty)
print("Program:", self.program)
print("Semester:", self.semester)
print("Year:", self.year)
class Doctor(Person):
def __init__(self, name, NationalID, phone, program,
faculty,semester,year, doctor_code, course, salary):
super().__init__(name, NationalID, phone, program,
faculty,semester,year)
self.doctor_code = doctor_code
self.course = course
self.salary = salary
self.hours_worked = 0
def print_account_details(self):
super().print_account_details()
print("Doctor Code:", self.doctor_code)
print("Course:", self.course)
print("Salary:", self.salary)
print("Hours Worked:", self.hours_worked)
def check_course(self):
print("Course:", self.course)
def check_hours_worked(self):
print("Hours Worked:", self.hours_worked)
def check_salary(self):
if self.hours_worked > 30:
overtime = self.hours_worked - 30
overtime_amount = overtime * (self.salary / 30)
total_salary = self.salary + overtime_amount
print("Salary (including overtime):", total_salary)
else:
print("Salary:", self.salary)
def doctor_system():
print("Welcome to the Doctor System!")
while True:
print("\nWelcome Doctor " + name +", What do you need
to do:")
print("1. Doctor Account Details")
print("2. Check Course")
print("3. Change Course")
print("4. Check Hours Worked")
print("5. Check Salary")
print("6. Add Hours Worked")
print("7. Logout and Exit")
if choice == "1":
doctor.print_account_details()
elif choice == "2":
doctor.check_course()
elif choice == "3":
new_course = input("Enter the new course: ")
doctor.change_course(new_course)
elif choice == "4":
doctor.check_hours_worked()
elif choice == "5":
doctor.check_salary()
elif choice == "6":
hours = float(input("Enter the number of hours to
add: "))
doctor.add_hours_worked(hours)
elif choice == "7":
print("Logged out. Exiting Doctor System.")
break
else:
print("Invalid choice. Please try again.")
class Student(Person):
def __init__(self, name, NationalID, phone, program,
faculty,semester,year, student_id, university_email):
super().__init__(name, NationalID, phone, program,
faculty,semester,year)
self.student_id = student_id
self.university_email = university_email
def print_account_details(self):
super().print_account_details()
print("Student ID:", self.student_id)
print("University Email:", self.university_email)
def check_NID(self):
print("National ID:", self._Person__NID)
def student_system():
print("Welcome to the Student System!")
# Account creation
name = input("Enter your name: ")
NationalID = input("Enter your National ID: ")
phone = input("Enter your phone number: ")
program = input("Enter your program: ")
faculty =input("Enter your Faculty: ")
semester = input("Enter your semester: ")
year = input("Enter your year: ")
student_id = input("Enter your student ID: ")
university_email = input("Enter your university email: ")
while True:
print("\nWelcome " + name +", What Do you need to do:")
print("1. Student Account Details")
print("2. Check National ID")
print("3. Change National ID")
print("4. Logout and Exit")
if choice == "1":
student.print_account_details()
elif choice == "2":
student.check_NID()
elif choice == "3":
new_NID = input("Enter the new National ID: ")
student.change_NID(new_NID)
elif choice == "4":
print("Logged out. Exiting Student System.")
break
else:
print("Invalid choice. Please try again.")
def login_menu():
print("Login Menu:")
print("1. Doctor System")
print("2. Student System")
choice = input("Enter your choice (1 or 2): ")
return choice
# Main program
choice = login_menu()
if choice == "1":
doctor_system()
else:
print("Invalid choice. Please try again.")