0% found this document useful (0 votes)
5 views

Program Specification

Uploaded by

Zawahir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Program Specification

Uploaded by

Zawahir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Program Requirements Document

Thursday, December 26, 2024

Application/ Program name: BMI Calculator


Written by: Muhammad Zawahir

Purpose or problem definition:

Design and implement a Java program to create a HealthProfile for an


individual, allowing input of personal information such as name, gender,
height, weight, and date of birth. The program should calculate and display
important health metrics including age, maximum heart rate, target heart rate
range, and body mass index (BMI). Additionally, the program should provide
BMI reference values.

Program Procedures:
1. Prompt the user to input personal information including first name, last
name, gender, height (in inches), and weight (in pounds).
2. Present the user with options to input either their approximate age or
their date of birth.
3. Based on the user's choice, input the age or date of birth and create a
HealthProfile object.
4. Calculate and display the individual's age, maximum heart rate, target
heart rate range, and BMI using the HealthProfile object.
5. Provide BMI reference values to compare the calculated BMI.
6. Ensure proper error handling and input validation throughout the
program.
7. Display the results in a clear and understandable format.

Algorithm/Processing/Conditions:
Inputs:

1. Prompt the user to input personal information: first


name, last name, gender, height (in inches), and weight
(in pounds).
2. Present the user with options to input either their
approximate age or their date of birth.
3. Based on the user's choice:
 If age is chosen:
 Input the approximate age.
 If date of birth is chosen:
 Input the date of birth in the format "YYYY-
MM-DD".

Processes:

Page 1 of 3
Program Requirements Document
Thursday, December 26, 2024

1. Calculate the age of the individual based on the provided


information.
2. Calculate the maximum heart rate using the formula: 220
- age.
3. Calculate the minimum target heart rate as 50% of the
maximum heart rate.
4. Calculate the maximum target heart rate as 85% of the
maximum heart rate.
5. Calculate the BMI using the formula: (weight * 703) /
(height * height) .
6. Display the individual's personal information, including
first name, last name, gender, age, height, and weight.
7. Display the calculated maximum heart rate, target heart
rate range, and BMI.
8. Display BMI reference values for comparison.

Outputs:
Display the results of the health profile analysis in a clear and understandable
format. Provide BMI reference values for the individual's BMI category
comparison. Ensure proper error handling and input validation for all user
inputs and calculations to handle invalid input gracefully.

Notes & Restriction:

All input data should be validated to ensure it meets the expected format and
ranges. For example, height and weight should be positive numbers, and the
date of birth should be in the format "YYYY-MM-DD". Handle exceptions
gracefully and provide clear error messages to the user in case of invalid input
or calculation errors. Ensure that the program follows good coding practices,
including proper indentation, naming conventions, and comments where
necessary to enhance readability and maintainability. Use appropriate data
types and structures to store and manipulate the input data and calculate results
efficiently. Provide options for the user to repeat the process or exit the
program after viewing the health profile results. Follow the specified
algorithms for input, processing, and output steps to ensure consistency and
correctness in the program flow. Test the program thoroughly with various
input scenarios, including edge cases and boundary conditions, to validate its
functionality and robustness. Document the program's functionality, including
its purpose, input requirements, processing steps, and output format, to
facilitate understanding and future maintenance.

Comments:

1. Clear User Prompts:

Page 2 of 3
Program Requirements Document
Thursday, December 26, 2024

 Prompts for user input are clear and informative,


guiding users on how to interact with the program
effectively.
2. Modular Design:
 Breaking down the functionality into separate
methods like assignSeat() and flightFull() enhances
readability and maintainability of the code.
3. Input Validation:
 The code effectively validates user input to ensure
that only valid choices are accepted, improving the
robustness of the program.
4. Comments:
 Code includes helpful comments that explain the
purpose of various sections and methods, aiding in
understanding the code's logic.
5. Error Handling:
 It would be beneficial to include error handling for
unexpected input or system failures to enhance the
reliability of the program.

Page 3 of 3

You might also like