Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed 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 methods

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago