A. Write a Java Program that includes the following details  You are tasked to develop a program to implement a simple Hospital Information System that will provide information about Hospitals such as their Doctors and Patient.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 20PE
icon
Related questions
Question

A. Write a Java Program that includes the following details 
You are tasked to develop a program to implement a simple Hospital Information System that will
provide information about Hospitals such as their Doctors and Patient.

 

1. Create a Hospital class and do the following:
a) Declare the following member variables: Hospital Id, and Hospital Name
b) Create a default constructor with no parameter.
c) Create a parameterized constructor to initialize all the member variables.
d) Create a method to display all the member variables.

 

2. Create a class Doctor and do the following:
a) The class should inherit the Hospital Class.
b) Declare a member variable Doctor id and Doctor salary.
c) Create a default constructor with no parameter
d) Create a parameterized constructor that will call the constructor of the parent class (super
class) and then initialize the member variables.
e) Create a method that will return a value to calculate the Doctor Salary by the Doctor using the
formula below:
Total Salary = Doctor Salary – (0.2 * Doctor Salary)
f) Create an overriding method to display all the member variables. The method should
invoke/call the super class display method and then display also all the member variables of
this class.

3. Create a class Patient and do the following:
a) The class should inherit the Hospital Class.
b) Declare a member variable Patient status and number of days
c) Create a default constructor with no parameter
d) Create a parameterized constructor that will call the constructor of the parent class (super
class) and then initialize the member variables.
e) Create a method that will return a value to determine the status of the patient based on the
criteria below:
When Patient status is equal to “in” and number of days is greater than or equal to 5
then the status of the patient is “Not good”.
Otherwise, the status of the patient is “OK”
The method should return the status of the patient.
f) Create an overriding method to display all the member variables. The method should
invoke/call the super class display method and then display also all the member variables of
this class.

 


4. Create a controlling class and do the following:
* Create an object for the two (2) subclasses
* Read the input, call the necessary methods, and display the required output as shown below.

Sample Input / Output
run:
Input Hospital Name:
Input Hospital Id:
Al-RAFA
123
Input Doctor id:
Input Doctor Salary:
101
1500.0
Hospital Id =123
Name = Al-RAFA
Doctor Details with Salary
Doctor
id
101
Doctor Salary =
1500.0
The Total
Salary is
1200.0
Input Patient
Staus:
IN
Input Number of
Days:
6.
Hospital Id -123
Name - Al-RAFA
Patient Details with Satus
Patient Status
IN
%3D
Number of days =
6.0
Status of
Patient
is Not good
BUILD SUCCESSFUL
(total
time:
7 minutes
O seconds)
Transcribed Image Text:Sample Input / Output run: Input Hospital Name: Input Hospital Id: Al-RAFA 123 Input Doctor id: Input Doctor Salary: 101 1500.0 Hospital Id =123 Name = Al-RAFA Doctor Details with Salary Doctor id 101 Doctor Salary = 1500.0 The Total Salary is 1200.0 Input Patient Staus: IN Input Number of Days: 6. Hospital Id -123 Name - Al-RAFA Patient Details with Satus Patient Status IN %3D Number of days = 6.0 Status of Patient is Not good BUILD SUCCESSFUL (total time: 7 minutes O seconds)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 1 images

Blurred answer
Knowledge Booster
Data members
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning