0% found this document useful (0 votes)
10 views14 pages

Statement P1.1-EnG 2

Uploaded by

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

Statement P1.1-EnG 2

Uploaded by

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

2024 – 2025 Academic Year

Programming I Projects

Semester 1 – Project 1
Healthy Child Program

Department of Engineering – Computer Science 1


2024 – 2025 Academic Year
Programming I Projects

Index
Introduction ....................................................................................................... 3
Functionalities ................................................................................................... 4
Option 1: Add child data ............................................................................. 6
Option 2: Calculate BMI ............................................................................. 8
Option 3: Statistics ................................................................................... 11
Option 4: Exit............................................................................................ 12
Considerations ................................................................................................ 13
Deadlines & Evaluation ................................................................................... 14

Department of Engineering – Computer Science 2


2024 – 2025 Academic Year
Programming I Projects

Introduction
In order to promote the health and well-being of children in the long run, the LSHealth
organization has asked La Salle to develop an application that can monitor children’s
growth. Specifically, they want to deploy in hospitals a system able to calculate the Body
Mass Index (BMI). The BMI is a simple measurement that relates weight to height, and in
children, it is a key tool to monitor their growth and development. This calculation will
allow for early detection of potential health problems such as being overweight or
malnourished, which helps parents and doctors make decisions to improve their children’s
diet.

OBJECTIVES
The final objective of this project is to have a first contact with the programming
environment and to practice the concepts of basic algorithms as discussed in class.
Concretely, it aims to:
• Reinforce reading keyboard inputs
• Reinforce writing data on the screen
• Reinforce the use of conditional statements
• Reinforce the use of alternative statements
• Reinforce the use of iterative statements
• Reinforce manual compilation of a C project

Department of Engineering – Computer Science 3


2024 – 2025 Academic Year
Programming I Projects

Functionalities

The program will start by verifying the identity of the doctor who will use the system by
asking for an identifier. To consider the identifier as valid, it will need to be formed by 6
digits (the number will never begin with 0). In any other situation, the program will show
an error message and finish its execution (see Output 1 and Output 2).

Output 1. Error message when the user enters an invalid identifier.

Output 2. Error message when the user enters an invalid identifier.

Once the doctor’s identity is validated, the program will show a welcome message while
indicating the doctor’s ID. Next, the different options that can be executed will be shown
in the form of a menu. These options are: “Add child data”, “Calculate BMI”, “Statistics”
and “Exit” (see Output 3).

Output 3. Main menu with four options.

After executing any option in the menu (except for “Exit”), the program must go back to
the main menu. As we will see later, if the “Exit” option is executed, the program will finish.
Note that the user must be able to select any available option by entering a capitalized or
non-capitalized letter (case insensitive).
If the user enters an invalid option, the program must show an error message indicating
this circumstance (see Output 4). Afterwards, the main menu will be shown again.

Department of Engineering – Computer Science 4


2024 – 2025 Academic Year
Programming I Projects

Output 4. The user enters invalid options.

Department of Engineering – Computer Science 5


2024 – 2025 Academic Year
Programming I Projects

Option 1: Add child data

The “Add child data” option is executed when a user wants to add the information of a
child. A person that is between 1 and 12 years old is considered a child, therefore the
program must ask for the child’s age. If the entered age does not comply with the
established requirement, an error message will be shown and the program will ask for the
age again (until it is correct) (see Output 5).

Output 5. Option 1, Add child data. The user enters an incorrect age. Next, the program displays an error message
and asks for the age.

Once the age is checked, the program must ask for the height (in cm) and the weight (in
lb) of the child (see Output 6).

Output 6. Option 1, Add child data. The user enters a correct age. Next, the program asks for the child’s height and
weight. Once all data is entered, the main menu is shown again.

Department of Engineering – Computer Science 6


2024 – 2025 Academic Year
Programming I Projects

Keep in mind that both the height and the weight must be positive values. Otherwise, an
error message will be shown and the values will be asked for again (see Output 7).

Output 7. Option 1, Add child data. The user enters an incorrect height or weight. The program shows an error
message and asks for the data a second time. Once all data in entered, the program goes back to the main menu.

Department of Engineering – Computer Science 7


2024 – 2025 Academic Year
Programming I Projects

Option 2: Calculate BMI

With the “Calculate BMI” option, the program must calculate the body mass index of the
last child that was added to the system and display the resulting value on the screen. It
is well known that, based on the BMI value, the weight of the child can be classified in
one of the following categories: Low weight, Normal and Overweight. Next, the formula
to calculate the BMI is provided:

𝑤𝑒𝑖𝑔ℎ𝑡(𝑘𝑔)
BMI = 2
(ℎ𝑒𝑖𝑔ℎ𝑡(𝑚) )

Keep in mind that 1Kg is equivalent to 2.2lb.


In case the BMI of a child is under 18.5, it is considered as low weight. Between 18.5 and
24.9, it is considered to be normal. Over 24.9, it is considered as overweight. The
following table provides the constants with which these values are represented:

LOW_WEIGHT 18.5

NORMAL_WEIGHT 24.9

In the case of a Low weight child, a notification message must be displayed on the screen
to express the need for a nutrition plan (see Output 8).

Output 8. Option 2, Calculate BMI (Low weight case). The program calculates and shows the BMI value. In this case,
it is a low weight case so a notification message is shown.

Afterwards, the program must ask when will the next appointment be conducted (value in
weeks) because, depending on the age, the program must estimate the weight of the
child for that appointment. To predict the child’s weight, the average weight gain is
estimated to be of 2Kg for children under 7 years old. Children of 7 years old or over have
a faster growth rate, so they are expected to gain 2,4Kg per year. It can be assumed that
a year is made of 365 days and that there are no leap-years.

Department of Engineering – Computer Science 8


2024 – 2025 Academic Year
Programming I Projects

An important consideration is that the week value cannot be superior to 20, so an error
message must be displayed if this restriction is not met to notify the user. One can assume
that in that timeframe the child will have the same age as when the data was entered,
which is the reference value for the weight estimation.
The whole functionality of this case is shown in Output 9.

Output 9. Option 2, Whole execution for the Low weight case. The program, after showing a notification message,
asks for the next appointment and validates the entered value. If it is valid, the estimated weight is calculated and
shown on the screen. Otherwise, an error message is shown and the next appointment value is asked again. After
displaying the last notification, the program goes back to the main menu.

In case the child’s weight is Normal, a notification message will be shown to express the
well-being of the child (see Output 10).

Output 10. Option 2, Calculate BMI (Normal case). The program shows a notification message and goes back to the
main menu.

If the BMI indicates Overweight, a notification message must be displayed on the screen
(see Output 11).

Department of Engineering – Computer Science 9


2024 – 2025 Academic Year
Programming I Projects

Output 11. Option 2, Calculate BMI (Overweight case). The program shows a notification message and goes back to
the main menu.

Note that option b cannot be accessed unless the data required by option a is filled. If this
is not the case, an error message will be displayed (see Output 12).

Output 12. Option 2, Calculate BMI. The program shows an error message if data has not been entered in option a
and goes back to the main menu.

Department of Engineering – Computer Science 10


2024 – 2025 Academic Year
Programming I Projects

Option 3: Statistics

With the “Statistics” option, we can obtain a group of global statistics about all the data
from the children introduced to the system. In these statistics, it will be shown the number
of children for each weight category (those previously stablished) and the percentage that
each represent out of the total children introduced (see Output 13).

Output 13. Option 3, Statistics. The program shows the number of children for each category (Low, Normal,
Overweight) with the percentage that it represents out of all the children. Once the message is shown, the program
goes back to the main menu.

Additionally, this option will only be accessible if the BMI has been previously calculated.
Otherwise, the program must display an error message (see Output 14).

Output 14. Option 3, Statistics. The program shows an error message if the BMI has not been calculated and goes
back to the main menu.

Department of Engineering – Computer Science 11


2024 – 2025 Academic Year
Programming I Projects

Option 4: Exit

Option 4 displays a goodbye message and ends the execution of the program (see Output
15).

Output 15. Option 4, Exit. The users enters option d (or D) and the program is terminated.

Department of Engineering – Computer Science 12


2024 – 2025 Academic Year
Programming I Projects

Considerations
To implement this project, you must keep in mind the following considerations:
1. The format of the examples must be followed.
2. On the screen output there will be at most one blank line (observe the examples
throughout the statement).
3. Error management must be conducted exactly as demanded in the statement. If it
says that a value must be asked for again, going back to the main menu (for
example) will not be accepted.
4. The code must be correctly commented so that it is easily readable. Check that
you are following the subject’s style guide.
5. For the project to be accepted, it is mandatory that it passes all the CodeRunner
tests satisfactorily and that the Software Quality and Report grades are superior to
1.
6. The program must be developed exclusively in the Matagalls’ Linux environment,
using the Vim editor to write the C code and the GCC compiler to obtain the
runnable file. There you can test the project before testing it in CodeRunner.
7. It is forbidden to use any C instruction that has not been explained in class.

Department of Engineering – Computer Science 13


2024 – 2025 Academic Year
Programming I Projects

Deadlines & Evaluation


The deadline of this project to obtain the highest grade is the 17th of November of 2024.
For a project to be considered delivered, the following conditions must be met:
1. Run the code in the CodeRunner of the project and successfully pass the tests.
2. Deliver a .c file with the code of the project to the corresponding section in eStudy.
3. Submit a final report of the practice, including:
a. Cover page and table of contents
b. Brief summary of the project statement
c. Project’s Activity Diagram (pictures of hand-made diagrams in paper are not
accepted)
d. Main difficulties and solutions applied
e. Conclusions
f. Estimation of the time spent to carry out the project

Remember that the practice will be evaluated as follows:

• Execution: It has a weight of 60% and evaluates the correct functioning of the
project. This will be the grade obtained on the CodeRunner tests.

• SW Quality: It has a weight of 20% and the quality of the delivered code and
adherence to the Programming Style Guide (available on eStudy) is evaluated.

• Documentation: It has a weight of 20% and it will be evaluated by reviewing the


content of all the points of the report.

The evaluation of the project will be over a maximum of 10 points, 8 points or 6 points,
depending on when the execution tests are passed:
Over 10 points: until the 17th of November 2024, at 23:59h.
Over 8 points: until the 26th of January 2025, at 23:59h.
Over 6 points: until the 6th of July 2025, at 23:59h.

Department of Engineering – Computer Science 14

You might also like