Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objectives: Use Javadocs to document aclassand methods Design a Javaclass Use fields (instance variables) Write multiple constructors Write accessor methods Write mutator methods Use thethiskeyword

Objectives:

Use Javadocs to document aclassand methods

Design a Javaclass

Use fields (instance variables)

Write multiple constructors

Write accessor methods

Write mutator methods

Use thethiskeyword

Use string concatenation

Round floating point numbers (usingMath.round())

Write test cases

Use aScannerobject

(This exercise is very picky and wont run properly unless these exact method names are used)

Description For this project, you get to design aPatientclassthat stores a patient's first name, height and weight as fields. Include both a constructor without any parameters and one with parameters for name (String), height (double) and weight (double) (in that order). Include appropriate accessor and mutator methods (and label them with comments including the terms "accessor" or "mutator"). Use the naming conventions ofsetValue()andgetValue()(i.e.,setName()andgetName(), etc.). Appropriately, include thethiskeyword in your code. Additionally, include a method namedtoString()that returns aStringformatted as in the examples below (including rounding to one decimal place). Include anupdateBMI()method that calculates the Body Mass Index of the patient based on the following formula: BMI = 703 * weight_in_lbs / (height_in_inches * height_in_inches). Also include an accessor method namedgetBMI. Note: make sure that the BMI is correct before returning it. Write at least three test cases for theupdateBMI()method in amain()method in thePatientclass. Put each test case into a different method, namedtest1(),test2()andtest3(). Document both thePatientclassand its methods with comments and Javadoc comments. Create aMainclassthat requests input from the user and populates aPatientobject and calls it'stoString()method. Create aMainclassthat requests input from the user and populates aPatientobject and calls it'stoString()method. Examples for the input and output part (user input inbold face blue): Please enter the patient's first name: Donald You entered Donald Please enter the patient's height (in inches): 75 You entered 75.0 Please enter the patient's weight (in inches): 243.0 You entered 243.0 Patient: Donald is 75.0 inches tall and weighs 243.0 pounds (BMI: 30.4)Please enter the patient's first name: Mary You entered Mary Please enter the patient's height (in inches): 68.0 You entered 68.0 Please enter the patient's weight (in inches): 165 You entered 165.0 Patient: Mary is 68.0 inches tall and weighs 165.0 pounds (BMI: 25.1) and Please enter the patient's first name: Liam You entered Liam Please enter the patient's height (in inches): 72.1 You entered 72.1 Please enter the patient's weight (in inches): 185 You entered 185.0 Patient: Liam is 72.1 inches tall and weighs 185.0 pounds (BMI: 25.0)

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

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions