PYTHON PROGRAMMING ONLY Im making a patient portal/ record keeping system but my code isnt working please help code below (class Menu section isnt working also menu =Menu() isnt working) CODE: class Person: def __init__(self, name, dob, address, phone_number): self.name = name self.dob = dob self.address = address self.phone_number = phone_number class Patient(Person): def __init__(self, name, dob, address, phone_number, medical_history): super().__init__(name, dob, address, phone_number) self.medical_history = medical_history class Menu: def __init__(self): self.options = { 1: self.view_personal_info, 2: self.update_personal_info, 3: self.view_medical_history, 4: self.update_medical_history, 5: self.exit } def display(self): print("Menu:\n") print("1. View personal information") print("2. Update personal information") print("3. View medical history") print("4. Update medical history") print("5. Exit") def run(self): while True: self.display() choice = input("Enter your choice: ") try: choice = int(choice) except ValueError: print("Invalid choice. Please enter a number.") continue if choice in self.options: self.options[choice]() else: print("Invalid choice. Please try again.") def view_personal_info(self): print(f"Name: {patient.name}") print(f"Date of Birth: {patient.dob}") print(f"Address: {patient.address}") print(f"Phone Number: {patient.phone_number}") print("\n") def update_personal_info(self): name = input("Enter your name: ") dob = input("Enter your date of birth: ") address = input("Enter your address: ") phone_number = input("Enter your phone number: ") patient.name = name patient.dob = dob patient.address = address patient.phone_number = phone_number print("Your personal information has been updated.") print("\n") def view_medical_history(self): print(f"Medical History: {patient.medical_history}") print("\n") def update_medical_history(self): medical_history = input("Enter your updated medical history: ") patient.medical_history = medical_history print("Your medical history has been updated.") print("\n") def exit(self): print("Goodbye!") exit() class Data: def __init__(self, file_name): self.file_name = file_name def load(self): with open(self.file_name, 'r') as f: data = f.read() return data patient = Patient("John Doe", "01/01/1990", "123 Main St.", "555-555-5555", "No significant medical history.") menu = Menu() menu.run()

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

PYTHON PROGRAMMING ONLY 

Im making a patient portal/ record keeping system but my code isnt working please help code below

(class Menu section isnt working also menu =Menu() isnt working)

 

CODE:

 

class Person:
def __init__(self, name, dob, address, phone_number):
self.name = name
self.dob = dob
self.address = address
self.phone_number = phone_number


class Patient(Person):
def __init__(self, name, dob, address, phone_number, medical_history):
super().__init__(name, dob, address, phone_number)
self.medical_history = medical_history

class Menu:
def __init__(self):
self.options = {
1: self.view_personal_info,
2: self.update_personal_info,
3: self.view_medical_history,
4: self.update_medical_history,
5: self.exit
}

def display(self):
print("Menu:\n")
print("1. View personal information")
print("2. Update personal information")
print("3. View medical history")
print("4. Update medical history")
print("5. Exit")

def run(self):
while True:
self.display()
choice = input("Enter your choice: ")

try:
choice = int(choice)
except ValueError:
print("Invalid choice. Please enter a number.")
continue

if choice in self.options:
self.options[choice]()
else:
print("Invalid choice. Please try again.")





def view_personal_info(self):
print(f"Name: {patient.name}")
print(f"Date of Birth: {patient.dob}")
print(f"Address: {patient.address}")
print(f"Phone Number: {patient.phone_number}")
print("\n")


def update_personal_info(self):
name = input("Enter your name: ")
dob = input("Enter your date of birth: ")
address = input("Enter your address: ")
phone_number = input("Enter your phone number: ")

patient.name = name
patient.dob = dob
patient.address = address
patient.phone_number = phone_number

print("Your personal information has been updated.")
print("\n")


def view_medical_history(self):
print(f"Medical History: {patient.medical_history}")
print("\n")


def update_medical_history(self):
medical_history = input("Enter your updated medical history: ")
patient.medical_history = medical_history

print("Your medical history has been updated.")
print("\n")


def exit(self):
print("Goodbye!")
exit()

class Data:
def __init__(self, file_name):
self.file_name = file_name

def load(self):
with open(self.file_name, 'r') as f:
data = f.read()
return data


patient = Patient("John Doe", "01/01/1990", "123 Main St.", "555-555-5555", "No significant medical history.")
menu = Menu()
menu.run()

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education