Question
Write a Java program for the following. Problem: Suppose we want to help the patient to diagnose their health status. Create a program and ask
Write a Java program for the following.
Problem: Suppose we want to help the patient to diagnose their health status. Create a program and ask 3 questions from the patient to evaluate their health status.
Create a Patient class with the following (All of the data members and methods are private).
patientName
patientAge
gender (F-> female, M-> male)
healthStatus
The class include the following functionalities
Constructor with argument to initialize data members (patientName, patientAge, gender).
Getter for all instance variables
Setter for all instance variables
toString() to display Patient information
Create another class Client Class that will include two methods: investigate() and main().
investgiate ():
This method will ask questions from the patient with answers YES or NO. It will increment the healthStatus by one when the answer is YES.
The Questions are
Did you have any health issue like (blood pressure, heart): (YES | NO)
Are you visiting hospitals regularly for health issues: (YES | NO)
Are you smoking three times a day: (YES | NO)
main():
create two objects with the following information
Patient-01: Khalid Ali, 25, M
Patient-02: Asma, 29, F
Ask the patient questions
Display the user information along with health status using the toString() method based on the following criteria.
Number of YES Answer | Health Status |
healthStatus = 3 | High risk |
healthStatus = 2 | Medium risk |
healthStatus = 1 | Low risk |
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