Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Health Centerinfo name: string surname: string age - starvationRate: int + Health CenterInfo(string, string,int) + getName(): string + getSurname(): string + getFullName(: string + getStarvationRate():
Health Centerinfo name: string surname: string age - starvationRate: int + Health CenterInfo(string, string,int) + getName(): string + getSurname(): string + getFullName(: string + getStarvationRate(): int + setStarvationRate(int). void + checkStarvation(): bool + --Health Centerinfo) -extends -extends Employee employeeld: int Employee(string string,int,int) + getEmployeeld: int + checkStarvation(): bool + checkPatient(Patient); void + --Employeel Patient diseaseName: string + Patient(string, string,int,string) + set DiseaseName(): void + checkStarvation(): bool + takeACare(): void + --Patiento) extends -extends Doctor Nurse + Doctor(string, string,int, int) + checkPatient(Patient); void +-Doctor + Doctor(string, string.int,int) + checkPatient(Patient): void + --Nursel) Write a C++ program according to the UML diagram that is given above. In Health CenterInfo class, > For each Health Center Info object, its starvationRate will be 100 by default. getName() function returns "name" as a string. >getSurname() function returns "surname" as a string. > getFullName() function returns name surname as a string. >getStarvation Rate() function returns "starvationRate" as an integer. > checkStarvation() function, controls the starvationRate. By using this function check whether the starvationRate is below 20 or not. If it is below 20, function returns true, otherwise returns false. > Destructor displays a message like "name surname quit the health center." In Employee class, > Control the starvationRate by using checkStarvation() function. If the starvationRate less than 20. the function returns true, otherwise returns false. > checkPatient() function firstly decreases starvationRate 5 points. Then, displays a message that The patient named is checking. After that, contols checkStarvation(), if it returns true, displays a message (name) is starving." > Destructor displays a message "(name surname) quits the job in the health center." In Doctor class, checkPatient() function firstly decreases starvationRate 5 points. Then, displays a message that The patient named ..... checking.". Call takeACare() function of related patient. Display a message "(name) gives medicine to patient.". Then, controls checkStarvation(). If it returns true, displays a message like "(name) is starving!". > Destructor displays a message "(name surname) quit being a Doctor in this center!" In Nurse class, > checkPatient() function firstly decreases starvation Rate 10 points. Then, displays a message that The patient named .... checking." Call takeACare() function of related patient. Display a message "(name surname) took care of the patient.. Then, controls checkStarvation(). If it returns true, displays a message like "(name surname) is starving!. Destructor displays a message "(name surname) quit being a Nurse in this center!" In Patient class, checkStarvation() also controls the starvationRate. If the starvationRate less than 50, the function returns true, otherwise returns false. takeACare() function, firstly decrease starvationRate 15 points. Then, controls checkStarvation(). If it returns true, displays a message like Patient: name is hungry!!!". Destructor gives a message that name surname was discharged!" In your main function, Create an object from Doctor, Nurse and Patient class with the following data given below; Doctor: name David, surname Tennant, age 49, employeeld 181971. Nurse: name Jodie, surnmae Whittaker, age 38, employeeId 171982. Patient: name Matt, surname Smith age 37, diseaseName xyzxyz. Display full name of all people in the health center. Then, 5 times, firstly display nurse's name and call the checkPatient) function of it with the patient object as a parameter, then display doctor's name and call the checkPatient() function of it with patient object as a parameter. Sample Run 1: All people in this health center: David Tennant Jodie Whittaker Matt Smith Sample Run 2: All employees works: Jodie Whittaker Patient named Matt Smith is checking! Jodie Whittaker took care of the patient. David Tennant Patient named Matt Smith is checking! David Tennant gives medicine to patient. Jodie Whittaker Patient named Matt Smith is checking! Jodie Whittaker took care of the patient. Sample Run 3: Matt Smith was discharged! Matt Smith is quit the health center. Jodie Whittaker is quit being a Nurse in this center! Jodie Whittaker is quits the job in the health center. Jodie Whittaker is quit the health center. David Tennant is quit being a Doctor in this center! David Tennant is quits the job in the health center. David Tennant is quit the health center
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started