Question: Program Description As responsible pet owners, we strive to ensure the well - being of our canine companions. Just like humans, maintaining a healthy weight
Program Description
As responsible pet owners, we strive to ensure the wellbeing of our canine companions. Just like humans, maintaining a healthy weight is crucial for dogs to lead happy and active lives. But how do you determine if your furry friend is at an ideal weight?
BMI Body Mass Index is a widely recognized measure that assesses how one's body mass compares to their height. Interestingly, this concept can also be applied to our beloved dogs, especially beagles. A dog BMI Calculator utilizes a formula that is like the one that is used for humans.
The dog BMI formula commonly used is:
BMI Weight Pounds Height Inches
You must design a fully objectoriented program using basic objectoriented concepts such as fields, getters, setters, methods. In addition to using basic objectoriented concepts your program must:
Demonstrate class collaboration using a "has a relationship between classes.
Include code that will prevent security holes.
Each class from above must contain at least the following methods:
A constructor that doesn't accept arguments
A constructor that accepts arguments for the name, height, weight, and gender fields.
Appropriate accessor and mutator methods ie setters and getters
A toString method
Other methods where appropriate or specified in the instructions below
Write a Beagle class that will represent a beagle. The Beagle class must contain the following information:
Beagle's name
Height in inches
Weight in Pounds
Gender
BMI
The Beagle class must contain the following methods:
calcHeightMeters
The calcHeightMeters method returns a string of the beagle's height in inches converted to meters where meters height in inches For example, if the height in the inches instance field equals the string returned should be 'Height m : m
calcWeightKilograms
The calcWeightKilograms method returns a string of the beagle's weight in pounds converted to kilograms where weight in kilograms weight in pounds For example, if the weight in the weight in pounds instance field equals the string returned should be 'Weight kg: kg
Write a BeagleBMI class that will represent the beagle's calculated BMI and used to evaluate the beagle's weight status. The BeagleBMI class must contain the following information:
The beagle's height in inches
The beagle's weight in pounds
The beagle's gender
The BeagleBMI class must include the following methods:
calcBMI
This method determines the beagle's BMI using the height in inches and weight in pounds.
The method must not accept any parameters and return a Double value that represents the beagle's BMI by using the following
Write a demo program that demonstrates the classes that you created above. The program must meet the following requirements:
The program must prompt the user for all the data necessary to fully initialize the objects.
The program must use the information entered from the user and instantiate objects using the information read in from the user.
Do not allow for any empty strings for names.
Do not accept any values that are less than inches and more than inches for the height of a beagle.
Do not accept any values that are less than pounds and more than pounds for the weight of a beagle.
The objects that are instantiated must be stored in an ArrayList.
The program must continue allowing the user to input information until the user indicates to stop see Sample Input and Output
After the user indicates that they wish to stop, the program must output the information for each beagle by implicitly calling its toString method.
After the program outputs the information for each beagle, it must output the total number of Beagle objects that were created, the average BMI for all beagles entered, and counts of the Underweight, Healthy, and Overweight status beagles. The total number of beagles must be kept track by a variable that is shared among instances of the Beagle class.
The program must display the input and output as shown in the provided Sample Input and Output Note: this includes formatting of numbers decimal places
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
