0% found this document useful (0 votes)
13 views6 pages

Assignment 1

The document contains an assignment with multiple exercises on developing a program to calculate BMR and TDEE. It requires inputs like name, age, gender, height, weight and activity level. It also involves writing pseudocode, identifying variables, describing test cases and discussing program ethics.

Uploaded by

emmanueldutt39
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)
13 views6 pages

Assignment 1

The document contains an assignment with multiple exercises on developing a program to calculate BMR and TDEE. It requires inputs like name, age, gender, height, weight and activity level. It also involves writing pseudocode, identifying variables, describing test cases and discussing program ethics.

Uploaded by

emmanueldutt39
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/ 6

ASSIGNMENT 1

NAME: Emmanuel Rahul Dutt.


ID: S11222968.

Exercise 1 [Organize & Manage]


(a) Write a pseudocode for your program.

Start

Initialize continueInput as a character


While continueInput is ‘Y’ or ‘y’:
Prompt the user for the following inputs:
- firstName (string)
- surname (string)
- age (integer)
- gender (character)
- height (double)
- weight (double)

Display option for Activity level:


- Sedentary (1)
- Lightly active (2)
- Moderately active (3)
- Very active (4)
- Super active (5)
Prompt the user to select an activity level (activityChoice):
- activityChoice (integer)
Display options for Goal:
- Lose weight (1)
- Maintain weight (2)
- Gain muscle (3)
Prompt the user to select a goal (goalChoice):
- goalChoice (integer)
Perform Data Validation:
If age, height, or weight is less than 0:
Display an error message and continue to the next iteration:
If gender is not ‘M’, ‘m’, ‘F’, or ‘f’:
Display an error message and continue to the next iteration:
Map activityChoice to activityLevel:
- Sedentary if activityChoice is 1
- Lightly active if activityChoice 2
- Moderately active if activityChoice 3
- Very active if activityChoice 4
- Super active if activityChoice 5
- Default to Sedentary if none of the above
Map goalChoice to goal:
- Lose weight if goalChoice is 1
- Maintain weight if goalChoice is 2
- Gain muscle if goalChoice is 3
- Default to Sedentary if none of the above

Calculate BMR based on gender:


If gender is ‘M’ or ‘m’:
BMR = 88.362 + (13.397 * weight) + (4.799 * height) – (5.677 * age)
ELSE:
BMR = 447.93 + (9.247 * weight) + (3.098 * height) – (4.330 * age)

Calculate TDEE based on activityLevel:


- Use the appropriate activityLevelMultiplier based on the user’ s
selection

Provide Dietary and Fitness Recommendations:


- Display a message with recommendation based on the goal and
activityLevel

Prompt the user to continue (continueInput):


- continueInput (character)
End While Loop

Display “Goodbye!”

End
Exercise 2 [Find & Generate]
Please answer the following:

1. Which variables do you need?


- firstName (string)112feuwvdfuvdcbvhdusvcv
- surname (string)chfvhbvfhibvyvihdbihdsbci
- age (integer)wdwgthbb
- gender (character)
- height (double)
- weight (double)
- activityChoice (integer)
- goalChoice (integer)
- activityLevel (string)
- goal (string)
- BMR (double)
- TDEE (double)
- continueInput (character)
2. Which variables do you use for input?
- firstName
- surname
- age
- gender
- height
- weight
- activityChoice
- goalChoice
3. Which types do you use for which variable. Explain why?
- firstName and surname: string, because they store names as text.
- age: integer, because age is a whole number.
- gender: character, because it represents a single character ('M' or 'F').
- height and weight: double, because they can have decimal values.
- activityChoice and goalChoice: integer, as they represent choices made by the user.
- activityLevel and goal: string, as they store textual information.
- BMR and TDEE: double, as they can have decimal values.
- continueInput: character, to store the user's choice to continue or not.
4. What type of loop is best to validate the input? What is the loop condition?
- A while loop is best to validate the input because it allows for repeated input and
validation until the user decides to exit.
- The loop condition is while continueInput is 'Y' or 'y'. This means that the loop will
continue as long as the user wants to enter more data.
Exercise 3 [Evaluate & Reflect]
Please describe at least three test cases that will allow you to assess whether the
program is correct. Which inputs should you choose, and what outputs would you
expect? Answer in less than 300 words. Does your program actually satisfy those test
cases?
Test Case 1: Valid Input
- Input:
- First Name: "Rex"
- Surname: "Deen"
- Age: 32
- Gender: M
- Height: 178 cm
- Weight: 83 kg
- Activity Level: "Moderately active"
- Goal: "Maintain weight"
- Expected Output:
- To ensure precise results, system developers focused on producing software able to
determine BMR & TDEE values from user data inputs.
- These guidelines ought to cater to distinct goals and exercise levels by offering
tailored nutrient and physical fitness advice.
- Evaluation:
- Valid inputs will measure the program's skill levels in suggesting practical responses
Correspondence between projected results and calculated values is crucial.
Test Case 2: Invalid Gender Input
- Input:
- First Name: "Rahul"
- Surname: "Dutt"
- Age: 27
- Gender: X (Invalid gender input)
- Height: 163 cm
- Weight: 57 kg
- Activity Level: "Lightly active"
- Goal: "Lose weight"
- Expected Output:
- Any invalid input, such as non-binary, should generate an appropriate warning
message before moving on. How gender options work?
- Evaluation:
- Testing will assess the program’s ability to identify and process improperly entered
gender information. An error message may arise as an expectation.

Test Case 3: Negative Age


- Input:
- First Name: “Ryan”
- Surname: "Kumar"
- Age: -5 (Negative age)
- Gender: M
- Height: 183 cm
- Weight: 76 kg
- Activity Level: "Very active"
- Goal: "Gain muscle"
- Expected Output:
- If the user inputted a negative value, a contradiction alert must appear and advance
process continuation be ensured.
- Evaluation:
- Can we gauge the software's accuracy regarding incorrectly entered ages through this
assignment? Expect a notification with errors.

Exercise 4 [Communicate & Apply Ethically]


The program for this assignment is honest, in that it reports honestly what the user
provides as input. Of course, rather than reporting what the user enters, your program
could make a biased report - a preferred option – more-nicer outcome if it wants to.
Would this be ethical to do? Would this be in line with the ACS Code of Ethics and with
basic Programming Ethics? Explain. Please answer in less than 300 words.
Providing skewed findings goes against moral principles, regardless of the desired conclusion
being favourable. Essential to the ACS (Australian Computer Society) Code of Ethics
together with foundational encoding polices is objectionable behaviour.
1. Integrity and Honesty (ACS Code of Ethics): Honestly and integrity form fundamental
aspects of accepted behaviour among colleagues. Attempting to create such a program
violates fundamental principles and ethics. Consistently presenting reliable facts,
programmers & developers strive comprehensively under integrity's banner
2. Transparency: At the core of coding moral standards lies clarity. Trusting in software's
ability, users seek reliable information and tailored guidance. Misrepresenting information
through deliberate distortion undermines reliance on system capabilities which users
rightfully expect accuracy within data provided
3. User Trust and Confidence: Providing valuable information, software is critical in
informing user choices. Software bias or manipulation breeds distrust with users, damaging
the developer's reputation alongside skewed results.
4. Accountability: Accountability is mandatory within programming circles. Consequences
resulting from prejudiced programming might pose a threat not only legally but also morally;
thus, timely action must arise.
In essence, ethical programming necessitates openness, accountability, and user-centric
commitment to factual accuracy and absence of bias. Manipulating or deliberately altering
data to achieve preferences violates ethical principles enacted under codes such as those
highlighted from A CS code of conduct & broader coding tenets (which specifically state
“Falsification or Fabric Aition/Frame Up”). This contains actions directed towards
misleadingly harming someone else’s name through rumour mongering along with
maliciously planned.
Exercise 5 [Embark & Clarify]
1. Please answer the following:
(a) Did you copy from other groups, other students, or public sources?
- I did not copy from other groups, however I have used some from public sources.
(b) Did you let other students copy from you?
- I did not let others copy my work.
2.
a. Did you put your name and student number on the first page? YES
b. Did you put your name and student numbers into the program? YES
c. Will you upload a write-up for Sections 2 & 4? YES
d. Did you upload the program for section 3? YES
e. Did you submit before the deadline? YES

You might also like