Q1. Create an User Defined Package in JAVA to define a method called SIZE() which will return the size of the passed string. Create DriverClass to call the method of that package.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
JAVA
Q1. Create an User Defined Package in JAVA to define a method called SIZE() which will return the
size of the passed string. Create DriverClass to call the method of that package.
Q2. Create a User Defined Package in JAVA to define two methods
1. To return the greatest of 3 numbers.
2. To return the square of a number.
Create DriverClass to call the methods of that package. Use your own variables.
Q3. Write a program in Java to create User Defined Packages for the following methods,
1. Method to return the absolute value of a number.
2. Method to return the string in CAPITAL LETTERS.
Transcribed Image Text:Q1. Create an User Defined Package in JAVA to define a method called SIZE() which will return the size of the passed string. Create DriverClass to call the method of that package. Q2. Create a User Defined Package in JAVA to define two methods 1. To return the greatest of 3 numbers. 2. To return the square of a number. Create DriverClass to call the methods of that package. Use your own variables. Q3. Write a program in Java to create User Defined Packages for the following methods, 1. Method to return the absolute value of a number. 2. Method to return the string in CAPITAL LETTERS.
Al Shifa hospital has been assigned as COVID 19 Detection Center. During the detection process, the
patient's data are also sent to determine if they have any of the chronic symptoms of high blood sugar or
high blood pressure.
a) Write a program in Java to help the hospital to do the determination in an easier way.
As the patient enters the hospital his basic details like civil_id, name, age, city of residence is recorded.
Create a class to do this.
• Initialize the member variables using a parametrized constructor.
• Define any abstract methods to make the coding more effective.
Then the patient is checked for the two sub categories Diabetic and Hypertensive.
b) In case of Diabetic sub category, the patient's sugar level is noted.
A method called getDiagnosis(sugar_level) to return the status of the patient as follows,
Sugar level Status
>120
"High Sugar"
"Low Sugar"
<70
Otherwise
"Normal"
A method display(): To display civil_id, name, age, city of residence, sugar level and status of the patient.
c) In case of Hypertensive sub category, the patient's systolic and diastolic are noted.
A method called getDiagnosis(systolic, diastolic) to return the status of the patient as follows,
Pressure level
Status
systolic >=130 && diastolic>=90
"High Pressure"
systolic <=100 && diastolic<=70
"Low Pressure"
Otherwise
"Normal"
A method display(): To display civil_id, name, age, city of residence, systolic and diastolic
status of the patient.
d) Create the objects of Diabetic and Hypertensive classes in the driver class.
As a testing procedure, pass 256 as sugar level in getDiagnosis() method to print the status.
As a testing procedure, pass 140 as systolic and 95 as diastolic in getDiagnosis() method to
print the status.
Use input statements to read the data and pass the variable values to the constructors of the
respective classes.
Call the respective methods to display all the details of both the sub categories.
Transcribed Image Text:Al Shifa hospital has been assigned as COVID 19 Detection Center. During the detection process, the patient's data are also sent to determine if they have any of the chronic symptoms of high blood sugar or high blood pressure. a) Write a program in Java to help the hospital to do the determination in an easier way. As the patient enters the hospital his basic details like civil_id, name, age, city of residence is recorded. Create a class to do this. • Initialize the member variables using a parametrized constructor. • Define any abstract methods to make the coding more effective. Then the patient is checked for the two sub categories Diabetic and Hypertensive. b) In case of Diabetic sub category, the patient's sugar level is noted. A method called getDiagnosis(sugar_level) to return the status of the patient as follows, Sugar level Status >120 "High Sugar" "Low Sugar" <70 Otherwise "Normal" A method display(): To display civil_id, name, age, city of residence, sugar level and status of the patient. c) In case of Hypertensive sub category, the patient's systolic and diastolic are noted. A method called getDiagnosis(systolic, diastolic) to return the status of the patient as follows, Pressure level Status systolic >=130 && diastolic>=90 "High Pressure" systolic <=100 && diastolic<=70 "Low Pressure" Otherwise "Normal" A method display(): To display civil_id, name, age, city of residence, systolic and diastolic status of the patient. d) Create the objects of Diabetic and Hypertensive classes in the driver class. As a testing procedure, pass 256 as sugar level in getDiagnosis() method to print the status. As a testing procedure, pass 140 as systolic and 95 as diastolic in getDiagnosis() method to print the status. Use input statements to read the data and pass the variable values to the constructors of the respective classes. Call the respective methods to display all the details of both the sub categories.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY