Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

B. Somewhat active (exercise oocasionally) C. Active {exercise 3-4 days per week] D. Highly active {exercise every day) If the user answers Inactiver then increase

image text in transcribedimage text in transcribedimage text in transcribed
B. Somewhat active (exercise oocasionally) C. Active {exercise 3-4 days per week] D. Highly active {exercise every day) If the user answers "Inactive"r then increase the calculated BMR by 20 percent. It the user answers "Somewhat active\" then increase the calculated BMR by 3D percent. It the user answers "Active" then increase the calculated BMR by 4D percent. Finally, if the user answers "Highly active" then increase the calculated Bth by EU percent. The program should then output the calculated daily lIllalories intake for this person in order to lose one pound per week by subtracting 500 calories from the calculated BMR. Input Errors It the user enters an age either i 1 or ;. 1m. instantly end the program with an error message. If the user enters a height s: It] or 2:- 1m. instantly end the program with an error message. If the user enters a weight s: 1D or a son. instantly end the program with an error message. You can assume that the user does not type some non-numeric value. You don't have to test for this kind of non-numeric error. If the user does not enter 'lvl' for male calculation or 'W' for female calculation, instantly end the program with an error message. If the user does not enter A, E, C, or D when prompted. instantly end the program with an error message. These limits must be detined as symbolic constants, which should be used throughout the program Rules: I For this assignment you are limited to the Java features in Chapters 1 through 3; you are not allowed to use more advanced features to solve the problem. Please do not use Java features that are not covered in lecture or the textbook. I Use class constants as appropriate to represent important xed data values in your program. I Follow programming guidelines and Java's naming standards about the format of ClassNames, variableNames, and CONSTANT NAMES. - Noce that all real numbers output by the program are printed with no more than 2 digits after the decimal point. To achieve this, you may use the Systouou Lprr'ntf method. Decision Structures Calorie Calculator Assignment Overview This assignment will give you practice with numerical calculations, simple input! output, and if-else statements. Program Objective: In this exercise you will unite a program the calculates the Daily Caloric needs for weight lose diet. According to everydayhealthcom they recommend this day caloric formula for a weight loss diet: BMR + Activity Level - 500 calories. Calories Calculator The Harris-Benedict equation estimates the number of calories your body needs to maintain your weight if you do no exercise. This is called your basal metabolic rate or BMR. The Calories needed for a woman to maintain her weight is: BMR = 655 + (4.3 * weight in pounds] + (4.? * height in inches) - (4.? " age in years] The Calories needed for a man to maintain his weight is: BMR = 66 + (6.3 * weight in pounds] + [12.9 * height in inches) - [5.8 * age in years] Next, the total daily caloric requirement is calculated by multiplying your BMR by your level of activity: a If the person is inactive (rarely exercise]r then increase the calculated 13th 20%. n It the person is somewhat aclive, then increase the calculated BMR by 30% - 1f the person is active, then increase the calculated BMR by 40% n It the person is highly active then increase the calculated BMR by 59% Program Specification: Write a program that allows the user to input their weight in potmds, height in inches, and age in years. Ask the user to input the string \"M\" if the user is a man and \"W" if the user is a woman. Use only the male formula to calculate calories if \"M\" is entered and use only the women formula to calculate calories if \"W\" is entered. Asktheuserifheorsheis: A. Inactive . Add the header to the class file and copy/ paste the output that is produced by your program into the bottom of the source code file, making it into a block comment. Class Name: Your program class should be called CalorieCalculator. Sample output Calorie Calculator - Daily Caloric Needs for a weight loss diet. what is your age in years? 30 what is your height in inches? 76 what is your weight in pounds? 220 Enter "M' for male calculation or "W' for women calculation M Are you: A. Inactive (rarely exercise) B. Somewhat active ( exercise occasionally) C. Active (exercise 3-4 days per week) D. Highly active (exercise every day) Enter A, B, C, or D. B A male with those measurements is suggested to intake about 2396.92 kcal/day in order to loose ~11b/week! #*#*Thank You For Using This Program!**s

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 Programming questions