Question

paython code :- UML A hospital is a very busy place with a lot of patients...

paython code :- UML

A hospital is a very busy place with a lot of patients and also a lot of employees to keep
the system running perfectly. All people in the hospital have basic information like title,
name, gender, address, and phone number. Employees of the hospital have extra
information like employee-id and salary. For every 25 employees, there is a manager who
is also an employee, but gets an allowance of 7% more than the salary. There are also
doctors and nurses who are employees in the hospital. Doctors and nurses are assigned to
a specific department, like dental, pediatric, cardiac, and so on. Then, there are two types
of patients in the hospital, the In-Patients and the Out-Patients, while both have all the
basic information, the In-Patients have a room number where they are admitted.
You are required to draw the UML Class diagram and create Python classes to represent
the different types of people in a hospital. Identify the classes and the relationships
between them. Implement the classes in Python.

Create a separate test module where instances of the class are created, and the methods are tested by creating a list of differentpeople in the hospital and displaying their informationInclude also a Test class, to test the functionalities of the implemented classes.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

class people:
title=None
name=None
gender=None
address=None
phone=None

class employee:
emp_id=None
salary=None
  
class hospital(employee,people):
room_no = None
dept = None
def patient(self, title,name,gen,add,phone, room=None):
self.title = title
  
if self.title == 'In-Patients':
self.room_no = room
  
self.name = name
self.gender = gen
self.address = add
self.phone = phone
  
def show_patient(self):
print('Title - ',self.title)
print('Name - ',self.name)
print('Gender - ',self.gender)
print('Address - ',self.address)
print('Phone - ',self.phone)
  
if self.room_no:
print('Room Nom - ',self.room_no)
  
def employee(self, title,name,gen,add,phone,emp_id, salary, dept=None):
self.title = title
  
if self.title == 'Doctor' or self.title == 'Nurse':
self.dept = dept
  
self.name = name
self.gender = gen
self.address = add
self.phone = phone
self.emp_id = emp_id
self.salary = salary
  
def show_employee(self):
print('Title - ',self.title)
print('Emp ID - ',self.emp_id)
print('Name - ',self.name)
print('Gender - ',self.gender)
print('Salary - ',self.salary)
print('Address - ',self.address)
print('Phone - ',self.phone)
  
if self.dept:
print('Department - ',self.dept)
  
in_patient = hospital()
in_patient.patient('In-Patients','Ajay', 'Male','Chennai', 9983471202, 201)
in_patient.show_patient()

print('****************************')
out_patient = hospital()
out_patient.patient('Out-Patients','Vinod', 'Male','Chennai', 8983471285)
out_patient.show_patient()

print('****************************')
emp = hospital()
emp.employee('Receptionist','Mala', 'Female','Chennai', 7883471202, 2222, 25000)
emp.show_employee()

print('****************************')
doc = hospital()
doc.employee('Doctor','Kishor', 'Male','Chennai', 7889471222, 4747, 89000, 'Dental')
doc.show_employee()

Add a comment
Know the answer?
Add Answer to:
paython code :- UML A hospital is a very busy place with a lot of patients...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • We would like to design a database to maintain information about hospital staff, including doctors and...

    We would like to design a database to maintain information about hospital staff, including doctors and nurses, and patients at the hospital. Construct a crow’s feet diagram using the information provided. The information we need includes: Staff, including their names, addresses and social-security numbers. Patients, including their names, addresses, and the name of their insurance company. Patients are each assigned to a ward (room). Those staff who are nurses are assigned to zero or more wards. Each ward has at...

  • The project description As a programmer; you have been asked to write a program for a Hospital wi...

    program Java oop The project description As a programmer; you have been asked to write a program for a Hospital with the following The Hospital has several employees and each one of them has an ID, name, address, mobile number, email and salary. . The employees are divided into Administration staff: who have in addition to the previous information their position. Nurse: who have their rank and specialty stored in addition to the previous o o Doctor: who have the...

  • Write a python program that computes a patients bill for a hospital stay. The different components of the program are The patientAccount class The Surgery class The Pharmacy class The main program -Th...

    Write a python program that computes a patients bill for a hospital stay. The different components of the program are The patientAccount class The Surgery class The Pharmacy class The main program -The PatientAccount class will keep a total of the patient's charges. It will also keep track of the number of days spent in the hospital. The group must decide on the hospital's daily rate. -The Surgery class will have stored within it the charges for at least five...

  • UML Class Diagram with Inheritance Objectives Use UML Correctly indicate inheritance Demonstrate permissions Understand inheritance relationships...

    UML Class Diagram with Inheritance Objectives Use UML Correctly indicate inheritance Demonstrate permissions Understand inheritance relationships Labwork Please read all of the directions carefully. You will create a UML class diagram reflecting the class hierarchy for a fictional program that manages university personnel as constructed according to the graph displayed below. You will need to think about the attributes and behaviors that are unique to each class, and also those attributes and behaviors that are common amongst the subclasses and...

  • program Java oop The project description As a programmer; you have been asked to write a...

    program Java oop The project description As a programmer; you have been asked to write a program for a Hospital with the following The Hospital has several employees and each one of them has an ID, name, address, mobile number, email and salary. . The employees are divided into Administration staff: who have in addition to the previous information their position. Nurse: who have their rank and specialty stored in addition to the previous o o Doctor: who have the...

  • write in java and please code the four classes with the requirements instructed You will be...

    write in java and please code the four classes with the requirements instructed You will be writing a multiclass user management system using the java. Create a program that implements a minimum of four classes. The classes must include: 1. Employee Class with the attributes of Employee ID, First Name, Middle Initial, Last Name, Date of Employment. 2. Employee Type Class that has two instances of EmployeeType objects: salaried and hourly. Each object will have methods that calculates employees payrol...

  • Open Visual Paradigm for UML. File | New Project. Set the Project name to {FLname}MyCompanyDesign, where...

    Open Visual Paradigm for UML. File | New Project. Set the Project name to {FLname}MyCompanyDesign, where {FLname} is replaced by the first letter of your first name plus your last name. E.g. if your name is Maria Marciano, your project name must be MMarcianoMyCompanyDesign. Click the Create Blank Project button. Save the .vpp file in the root of your Eclipse project directory. File | Save As... Use the ... button to navigate to the root of your Eclipse project directory....

  • Tiny Hospital keeps information on patients and hospital rooms. The system assigns each patient a patient...

    Tiny Hospital keeps information on patients and hospital rooms. The system assigns each patient a patient ID number. In addition, the patient’s last name, first name, date of birth, and date of admission are recorded. Also, every patient is seen by a Physician who develops a treatment plan for the patient. Each Physician may see many patients. Some patients are resident patients (they spend at least one night in the hospital) and others are outpatients (they are treated and released)....

  • I learned that not enough nurses advocate for change in legislation that will benefit patients, patient...

    I learned that not enough nurses advocate for change in legislation that will benefit patients, patient family, cost of care, and better quality care practices. In the module, it talked about how Ohio nurses aren't represented in Ohio legislation. That only 3 people from the health care industry participate in Ohio politics and that two of them are physicians and the last one is a pharmacist. Nurses should have more of a voice in politics since they are the ones...

  • Java Programming Exercise: Creating and implementing a UML class diagram The inventory of a library is...

    Java Programming Exercise: Creating and implementing a UML class diagram The inventory of a library is a set of media. Media can be books, CDs and films. Each medium has a unique alphanumeric ID, a title, a year of publication and the date on which it was purchased. Each book also has an author and an ISBN. For each CD the artist and the number of titles are saved. Each movie has a genre and a format: either DVD or...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT