CSCI1260 Introduction to Computer Science 2 by HC111205175524

VIEWS: 0 PAGES: 2

• pg 1
```									                     CSCI1260 Introduction to Computer Science 2

Project 2
Making a Difference (Part 2)
A health care issue that has been in the news is the computerization of health records. This possibility is being
approached cautiously because of sensitive privacy and security concerns, among others. Computerizing
health records could make it easier for patients to share their health profiles and histories among their health
care professionals. This could improve the quality of health care, help avoid drug conflicts and erroneous drug
prescriptions, reduce costs and in emergencies, could save lives.

In this project, you’ll build upon the HealthProfile class you created in Project 1.

A personal trainer wishes to track the health profile of her 8 clients. The program should begin by first
allowing the personal trainer to input the health profile information of her 8 clients. After the data has been
entered, the program then produces the following report:

   The names and weights of all “Underweight” clients or an appropriate message if there are none.
   The names and weights of all “Overweight” clients or an appropriate message if there are none.
   The names and weights of all “Obese” clients or an appropriate message if there are none.
   The average weight, height, and BMI of the clients.
   The name and weight of the heaviest person.
   The name and weight of the lightest person.
   The name and BMI of the person with the highest BMI.
   The BMI values for the clients

BMI Values Chart
Underweight: less than 18.5
Normal:      between 18.5 and 24.9
Overweight: between 25 and 29.9
Obese:       30 or greater

Data Restrictions on the HealthProfile class

   First name and last name cannot be null or the empty string. The setters should not set the first or last
name if these conditions are true.
   Use an enumerated type for gender (MALE, FEMALE). See section 6.12 of the text on how to create and
use enumerated types.
   Instead of having separate setters for month of birth, day of birth, and year of birth, have one method that
accepts three parameters representing these three values. The method should verify that the three values
together form a valid date and only set the attributes if they indeed form a valid date. See below on date
validation.
   Height cannot be less than 24 or greater than 120. The height setter should only set the attribute if the
incoming height is within this range.

1
CSCI1260 Introduction to Computer Science 2

   Weight cannot be less than 30 or greater than 2000. The weight setter should only set the attribute if the
incoming weight is within this range.

Input Validation

   First name and last name cannot be blank. If the user enters blanks for either of these, an appropriate
error message should be displayed and the user asked to reenter the name.
   Gender should be inputted as either ‘M’ or ‘F’ (case should not matter). If the user enters anything else, an
appropriate error message should be displayed and the user asked to reenter the gender.
   The inputted values for month of birth, day of birth, and year of birth, must form a valid date. If the date is
invalid, an appropriate error message is displayed and the user asked to renter all three values. See below
for date validation.
   Height cannot be less than 24 or greater than 120. If the user enters a value outside this range, an
appropriate error message is displayed and the user asked to reenter the height.
   Weight cannot be less than 30 or greater than 2000. If the user enters a value outside this range, an
appropriate error message is displayed and the user asked to reenter the weight.

Date Validation

“Thirty days hath September,
April, June, and November;
All the rest have thirty-one,
Save February, with twenty-eight days clear,
And twenty-nine each leap year.”

Leap Year Algorithm

if year is divisible by 400
then year is a leap year
else if year is divisible by 100
then year is not a leap year
else if year is divisible by 4
then year is a leap year
else
year is not a leap year
You should create a DateValidator class whose responsibility it is to validate dates based on the
information above. Your main class and your HealthProfile class would then use this class to validate
the date of birth.

Restrictions

   The design must consist of at least three classes, where one class handles all input and output, one
class handles the health profile processing, and the other handles date validation.
   The design must make use of an array of HealthProfiles.
   Please use the JOptionPane class for all input and output.

2

```
To top