Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python please 14.2 SS23 Project 1: Caloric needs calculator Overview In this project you will create a program to calculate a person's caloric needs based

python please
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
14.2 SS23 Project 1: Caloric needs calculator Overview In this project you will create a program to calculate a person's caloric needs based on their age, sex, height, and weight. To do this, you will prompt the user for these inputs and use these values to calculate the person's body mass index (BM) and a recommendation of caloric. intake to achieve a healthy weight. Objectives Labs programs are focused in scope, concentrating on one, and maybe two, concepts. Projects are more comprehensive, requiring you to pull multiple concepts together into a workable solution. One of the main skills you should develop in this class, even more important than Python syntax and techniques, is to teach you to read a problem specification and put together the concepts required to tolve it. This will - also require you to be more deliberate in your thinking and in breaking the problem down into smalle, mere manageable peces. You will Nor be able to read this description through once and then start coding. It will require some planning first before you ever start banging away at code. In fact, 10% of your score on the project will be your use of writing pseudocode before you ever begin actual Python code "The objective of this project is to create a solution combining multiple concepts that have been presented in class, demonstrating an understanding of: - inputing different types of data - outputing data according to specifications - using variables Note that you should only use techniques we have covered in class. Using more advanced concepts does not help your understanding of the basios, and is a red flag that the code may not be your own work. You will get docked points if you use constructs you were expressly told not to use. If you have questions about this as you work on your program, discuss them with the instructors during office hours. Problem Description Fictional health organization Healthy Spartans has tasked you wi. witing a simple program that can be used on their website that can help peopie calculate their caloric rieeds based on their physical attributes and levels of activity. First, the program should prompt for whether physical attributes of age in years, sex (m/f), height in inches, weight in pounds, and a selection for how physically active they are. Note that height and weight in imperial units will need to be converted to metric for calculations, but the final message is using imperial units. The following table details the conversions: The purpose of this program is to print a statement that details how many calories a person would need to consume more than, equal to, or less than in order to gain weight, maintain weight, or lose weight, respectively. To determine this, the program will calculate BMi and categorize people as underweight, healthy, Overweight, or obese, and the printed statement will reflect these categoties, To calculate BMI, the following formula will be used: BMI=( weight in kg)/(heightinm)2 A person's BMI will determine weight category according to the table below: To calculate the number of calories for this purpose, you will be using the following formulas: For males: Calocies required =((13.397 * weight in kg)+(4.799 height in cm )(5.677 * age in years )+88.362)( physical activity factor ) For females: Calonies required =((9.247 weight in kg)+(3.098 height in cm)(4.3303ge in years )+447.593)( physical activity factor ) ) Physical activity factor will be determined based on the table below: For males: Calories required =((13.397 * weight in kg)+(4.799 height in cm)(5.677 * age in years )+88.362)( physical activity factor ) For females: Calories required =((9.247 weight in kg)+(3.098 height in cm )(4.330 * age in years )+447.593)(physical activity factof) Physical activity factor will be determined based on the table below. When the user runs the program, they should be presented with the prompt. Enter your age in years: NOTE that this prompt and most prompts in your program should end with a colon and a newline. In the event that the user enters any value that is less than 0 , they should be given an error as follows: NOTE that this prompt and most prompts in your program should end with a colon and a newline. In the event that the user enters any value that is less than 0 , they should be given an error as follows. NOTE: Do not end your program by using break, exit, continue or similar constructs we have not covered. One of the goals of this project is to make sure you understand control flow using if statements, and if you can not write your program without using break or exit, you do not understand control fow well enough. Your scote will be penalized if you use these constructs, even if your code passes al the test cases. If provided a valid number, the program should proceed and print the following message, and prompt the user (you should have 3 lines total For the message and the input ptamps.) If you ldentity as non-binary or someching other than male or temale, choode one of either "m" or "f" that you' feel would be more accurate. enter your nex (m/t) : If the user enters anything that is not m or f, then the program should likewise give an error: If provided with a vaild sex, the program should proceed and then prompt the user for height: teight and weight should be integers (whole numbers) without any fractional parts: You may assume that the height and we-ght entered will be valid numbers and do not need to worry about checking whether the inputs are -valid. In the real world you would want to check validity of all inputs, but in the interest of not having you nest your ifs too deeply, you do rot need to error check height and weight for this project. After the user has entered numbers for height and weight, the program should then proceed to prompt the user for their level of phyeical activity as follows: Please aelect your physldal activity on a weekly basis: 1. Sedentary (1ititie of no exercise) 2. Lightiy Aotive (1ight exercise/sports 13 days/week) 3. Moderately Active (noderate exercise/sports 3-5 days/week) 4. Very Aetive (hard exercise/aporta 67 days/veek) 5. Extra Active (yery hard daily exereise/sporte \& physical job or 2X day training) Again, you do not have to check that the user entered something invalid, you can assume it will always be one of the given numbers. Hint. when getting the input for physical activity, since you have to print several lines, you may want to consider using standard print statements: for the buik of the instructions to the user, then using a promptless input statement to get the input itself. Or, you can use the final line as the prompt. Ether way, note that there needs to be a newine before the user types anything in. After the user has entered a valid selection for physical activity, the program should then perform the calculations necessary and output an appropriate message Example Let's say that the user is a 20 yeareold man who is 72 inches tall (60),200lbs, and is moderately active. In this case, his series of input prompts and the inputs would likely be: Inter your age in yearst 20 If you identify as non-binary or sooiething other than male or temale, choose one of either " m " or " f " that you feel vould be more accurate. tincex your tex (m/t). 1. Sedentary (litile of no exereisel 2. Light y hative (1ight exercise/sports 1-3 days/week) 3. Moderately Active (moderate exercise/aporta 35 days/week) 4. Very Active (hard exereise/sporti 6-7 days/week) 5. Fxtra ictive (very hard daily exercise/sporta 5 physical job or 2x day training) After providing these inputs, the man's BML should then be calculated. He should have a BMI of (2000.454)(72(254/100)227.149 and be considered overweight. The number of calories he would require will also be calculated. The calories required should be ((13.397200454)+(4.799722.54) ) (5.67720)+88.362)1.55=3206.812 calories. With these values calculated, we should expect an appropriate message of: A 6+0 male weighing 200 lbs would have a BMI of 27.15 which 18 considered overweight. At 20 years old and being Moderately Aetlve, you would require less than 3206.81 ealories in ordor to lose weight. Other examples for when a person is underweight or at a heaptity weight might be as follows A 5.5 female weighing 130 bs would have a ByI of 21.65 which is considered healehy. At 20 years old and being Moderately Active, you would require about 2198.26 calories in order to maintain weight. A 56 malo weighing 1001b would have a BMI of 36.15 which is conaidered underweight. At 20 years old and being Moderately Aetive, you would require more than 2150. 70 ealortee la orderto gain woight. So you will have sightly different messages depending on the sex of the person, their activity level, and their weight category. People who are under weight should intake more calories than the recommended in order to gain weight. People whio are overweight or obese should intake less calones in order to lose weight. People who are at a healthy weight should intake the recominended caiories to maintain weight. Note that these are just examples of what might be input. You do not know what a user or the auto grader may input, and your program must work no matter what the input is. Some of the test cases are hidden so you will not be able to see the input or outpat, but they will be like other visible test casen, so if you can pass the visible test cases but not the hidden ones, your program is likely doing something specific to the particular test cases. Note the following in the printed siatement: - Height is printed as feet and inches with an apostrophe separating the number of feet from the number of inches - The BMI has a precision of 2 decimal points - The number of calories has a precision of 2 decimal points A reminder that you are not allowed to work together on projects. Additional Important information on D2L under the Project 1 Checklist (in the Week 3 module) Make sure you read and understand the Project Checklist on D2L forimportant information on: - grading criteria and pseudocode requirement - checkpoints which lie to your engagement grade - academic honesty on projects and how not to get an Academic Dishonesty Report Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box. Once you have completed your pseudocode, replace this paragraph with a capy of the pseudocode and then add the actual Python code, one step at a time, for each step underneath the comment for that step. You should end with the complete pseudocode above by itself, and the complete pseudocode here interspersed with the actual Python code that matches each step. Run your program as often as you'd like, before submitting for grading. Below, type any needed-input values in the first box, then click Run program and observe the program's output in the second box

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions