Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Object-oriented programming 1. Consider the following class declaration. Identify invalid statements in the following main class. For each invalid statement, state why it is invalid.
Object-oriented programming
1. Consider the following class declaration. Identify invalid statements in the following main class. For each invalid statement, state why it is invalid. class Q1Main f public static void main( String[] args ) \{ Questionone q1; q1= new Questionone(); q1A=12; q1b=12; q1c=12; q1.methodone ( 12 ) ; q1 .methodone () ; system.out.println( q1.methodTwo ( 12 ) ) ; q1c=q1 methodTwo (); \} 2. What will be the output from the following code? class QuestionTwo \{ private int count; public void init ( ) \{ count =1; public void increment ( ) \{ count = count +1; public int getCount ()\{ return count; ; What will be the output from the following code? Q3Main and QuestionThre classes are the slightly modified version of Q2Main and QuestionTwo. 4. Create a class named Checkup with fields that hold a patient number, two blood pressure figures (systolic and diastolic), and two cholesterol figures (LDL and HDL). Methods: i. get and set for each of the fields ii. computecholestrolRatio() that divides LDL cholesterol by HDL cholesterol and returns the result. iii. explaincholestrolRatio() that explains that HDL is known as "good cholesterol" and that a ratio of 3.5 or lower is considered optimum. iv. bloodpressure() that displays blood pressure category based on the following table: v. Include the main () method and creates a Checkup object and demonstrate its methodsStep 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