Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Lab_6 / 15var")
- print("Task 1")
- class MOZ_A:
- phone = "+38(000) 000 00 00"
- address = "ул. Грушевского, 7"
- numberOfPatients = 150000
- site = "http://www.moz.gov.ua"
- workingHoursOpen = "9:00"
- workingHoursClose = "18:00"
- def print_info(self):
- print("Phone:", self.phone, "\n",
- "Address:", self.address, "\n",
- "Number Of Patients:", self.numberOfPatients, "\n",
- "Site:", self.site, "\n",
- "E-mail:", self.email, "\n",
- "Time Open:", self.workingHoursOpen, "\n",
- "Time Close:", self.workingHoursClose, "\n")
- class MOZ_B:
- def __init__(self, phone, address, numberOfPatients, site, email, workingHoursOpen="9:00",
- workingHoursClose="18:00"):
- self.__phone = phone
- self.__address = address
- self.__numberOfPatients = numberOfPatients
- self.__site = site
- self.__email = email
- self.__workingHoursOpen = workingHoursOpen
- self.__workingHoursClose = workingHoursClose
- print("Initialization is successful")
- def print_info(self):
- print("Phone:", self.__phone, "\n",
- "Address:", self.__address, "\n",
- "Number Of Patients:", self.__numberOfPatients, "\n",
- "Site:", self.__site, "\n",
- "E-mail:", self.__email, "\n",
- "Time Open:", self.__workingHoursOpen, "\n",
- "Time Close:", self.__workingHoursClose, "\n")
- def set_info(self, phone, address, numberOfPatients, site, email, workingHoursOpen="9:00",
- workingHoursClose="18:00"):
- self.__phone = phone
- self.__address = address
- self.__numberOfPatients = numberOfPatients
- self.__site = site
- self.__email = email
- self.__workingHoursOpen = workingHoursOpen
- self.__workingHoursClose = workingHoursClose
- print("Changes saved")
- print("\n=======Class A=======\n")
- A = MOZ_A()
- choice = 0
- while (choice != 3):
- while True:
- try:
- choice = int(input("1 - Print Info\n2 - Set new Info\n3 - Exit and continue\nYour choice:"))
- if (choice == 1):
- A.print_info()
- elif (choice == 2):
- A.phone = input("Enter new phone")
- A.address = input("Enter new address")
- A.numberOfPatients = input("Enter new numberOfPatients")
- A.site = input("Enter new site")
- A.email = input("Enter new email")
- A.workingHoursOpen = input("Enter new workingHoursOpen")
- A.workingHoursClose = input("Enter new workingHoursClose")
- elif (choice == 3):
- break
- except ValueError:
- print("Please enter a integer value")
- print("\n=======Class B=======\n")
- B = MOZ_B("+38(000) 000 00 00", "ул. Грушевского, 7", 150000, "http://www.moz.gov.ua", "[email protected]", "9:00",
- "18:00")
- choice = 0
- while (choice != 3):
- while True:
- try:
- choice = int(input("1 - Print Info\n2 - Set new Info\n3 - Exit and continue\nYour choice:"))
- if (choice == 1):
- B.print_info()
- elif (choice == 2):
- phone = input("Enter new phone")
- address = input("Enter new address")
- numberOfPatients = input("Enter new numberOfPatients")
- site = input("Enter new site")
- email = input("Enter new email")
- workingHoursOpen = input("Enter new workingHoursOpen")
- workingHoursClose = input("Enter new workingHoursClose")
- B.set_info(phone, address, numberOfPatients, site, email, workingHoursOpen, workingHoursClose)
- elif (choice == 3):
- break
- except ValueError:
- print("Please enter a integer value")
Advertisement
Add Comment
Please, Sign In to add comment