Question

IN PYTHON ONLY!!! Program 2: Design (Pseudocode) and implement (Source Code) a program that asks the...

IN PYTHON ONLY!!!

Program 2: Design (Pseudocode) and implement (Source Code) a program that asks the user for their height (in inches), weight (in pounds), age and gender. Use loops to validate user input and to continue running for a new user until a sentinel value is entered. Ask them to select their approximate level of exercise each week from the options below, then determine and print their allowed daily caloric intake using their BMR:

Female BMR = 655+(4.35 * weight) + (4.7 * height) - (4.7 * userAge );

Male BMR = 66+(6.23 * weight) + (12.7 * height) - (6.8 * userAge);

1.   You don't exercise: BMR x 1.2 = Calories Allowed

2.   You engage in light exercise one to three days a week: BMR x 1.375

3.   You exercise moderately three to five times a week: BMR x 1.55

4.   You exercise intensely six to seven days a week: BMR x 1.725

5.   You exercise intensely six to seven days a week and have a physically active job: BMR x 1.9

Sample Run 1: Female, 63”, 120 lbs, age 32, BMR = 1322.7, Exercise 3, DCA: 2050.18

Sample Run 2: Male, 72”, 200 lbs, age 32, BMR = 2008.8, Exercise 4, DCA: 3465.18

DCA = Daily Caloric Allowance

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The python 3 code for your assignment is given below .Make sure you use proper indentation as shown in screenshots

**********************bmr.py*************************


#the following function compute bmr
def calc_bmr(height,weight,gender,age):
if gender=='Female' or gender=='female':
return (655+(4.35 * weight) + (4.7 * height) - (4.7 * age ))
else:
return (66+(6.23 * weight) + (12.7 * height) - (6.8 * age))
  


ch='yes'
while ch=='yes':
gender=input('Enter your gender (Male/Female):')
  
while gender!='Male' and gender!='male' and gender!='Female' and gender!='female':
print('Enter valid gender (Male/Female)')
gender=input('Enter your gender:')
  
height=int(input('Enter your height in inches:'))
while height<=0:
print('Enter valid height:')
height=int(input('Enter your height:'))
  
weight=int(input('Enter your weight in lbs:'))
while weight<=0:
print('Enter valid weight:')
height=int(input('Enter your weight:'))
  
  
age=int(input('Enter your age:'))
while age<=0:
print('Enter valid age:')
age=int(input('Enter your age:'))
  
bmr=calc_bmr(height, weight, gender, age)
  
print('your BMR is %.2f'%(bmr))
  
print('Choose the level of Exercise')
print('1.You don\'t exercise\n2.You engage in light exercise one to three days a week')
print('3.You exercise moderately three to five times a week')
print('4.You exercise intensely six to seven days a week')
print('5.You exercise intensely six to seven days a week and have a physically active job')
  
choice=int(input('Enter your choice 1,2,3,4 or 5:'))
while choice!=1 and choice!=2 and choice!=3 and choice!=4 and choice!=5:
print('Enter valid choice')
choice=int(input('Enter your choice 1,2,3,4 or 5:'))
  
if choice==1:
dca=bmr*1.2
elif choice==2:
dca=bmr*1.375
elif choice==3:
dca=bmr*1.55
elif choice==4:
dca=bmr*1.725
else:
dca=bmr*1.9
  
print('your DCA is %.2f'%(dca))
  
print('Type yes to continue, no to exit')
ch=input('Enter yes/no:')

  

Add a comment
Know the answer?
Add Answer to:
IN PYTHON ONLY!!! Program 2: Design (Pseudocode) and implement (Source Code) a program that asks the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Fred has returned for his next visit. Client: Fred Age: 56 Height: 5 feet 10 inches                           ...

    Fred has returned for his next visit. Client: Fred Age: 56 Height: 5 feet 10 inches                            Weight: 270 pounds          BMR calculations: Males BMR= 66+(6.23 x weight in pounds) +(12.7 x height in inches) -(6.8 x age) Physical Activity (PA) Estimates 1.2 = little to no exercise 1.375 = light exercise 1-3 days per week 1.55 = moderate exercise 3-5 days per week 1.725 = hard exercise 6-7 days per week 1.9 = hard daily exercise/job 1. Today you want to...

  • Write a basic C++ program that will calculate a subject’s basal metabolic rate and estimate how...

    Write a basic C++ program that will calculate a subject’s basal metabolic rate and estimate how many days it will take to lose a specific number of pounds. The program will perform the following tasks: Declare variables and Named constants. Display “Welcome to <your name>’s Weight Loss Calculator” Prompt the user to enter the subject’s current weight. Prompt the user to enter the subject’s height in feet plus inches. Prompt the user to enter the subject’s age. Prompt the user...

  • Fred has returned for his next visit. Client: Fred Age: 56 Height: 5 feet 10 inches                           ...

    Fred has returned for his next visit. Client: Fred Age: 56 Height: 5 feet 10 inches                            Weight: 270 pounds          BMR calculations: Males BMR= 66+(6.23 x weight in pounds) +(12.7 x height in inches) -(6.8 x age) Physical Activity (PA) Estimates 1.2 = little to no exercise 1.375 = light exercise 1-3 days per week 1.55 = moderate exercise 3-5 days per week 1.725 = hard exercise 6-7 days per week 1.9 = hard daily exercise/job 5. Fred has mentioned several...

  • Design in Python (pseudocode) and implement (source code) a program (name it MyRectangle) that defines the...

    Design in Python (pseudocode) and implement (source code) a program (name it MyRectangle) that defines the following 3 methods: Method isValid() returns true if the sum of the width and height is greater than 30 Method Area() returns the area of the rectangle if it is a valid rectangle Method Perimeter() returns the perimeter of the rectangle if it is a valid rectangle The main method of MyRectangle prompts the user to enter the width and height of a rectangle...

  • Basic Nutrition (NUT 00200) Homework Assignment #3 Client Name: Brandon Anderson Age: 29 years old Height:6'0"...

    Basic Nutrition (NUT 00200) Homework Assignment #3 Client Name: Brandon Anderson Age: 29 years old Height:6'0" Weight: 200 lbs Current Percent Body Fat: 26 Desired Percent Body Fat: 16 Physical Activity: None 1. Calculate Brandon's BMI. What is his Weight Category? 2. According to the Body Fat Chart for Men, what is 3. Determine his Goal Body Weight and the amount of weight 4. Determine his Resting Energy and Total Energy 5. Use the Body Weight Planner web application to...

  • write by python code and screenshoot the python code for me. thanks The Problem: You are...

    write by python code and screenshoot the python code for me. thanks The Problem: You are to design a Calorie Intake Assistant tailored to the user’s personal characteristics. The assistant will initially ask the user for his/her gender, name, age in years, height in cm and weight in kg. Based on these, the assistant will calculate the recommended daily calorie intake (RDCI) using the Mifflin – St Jeor formula[1], which is also shown to the user: Mifflin – St Jeor...

  • IN PYTHON the original problem was Design (pseudocode) and implement (source code) a program (name it...

    IN PYTHON the original problem was Design (pseudocode) and implement (source code) a program (name it WeeklyHours) to compute the total weekly hours for 3 employees. The program main method defines a two-dimensional array of size 3x7 to store employers’ daily hours for the week. Each row represents one employee and each column represent one day of the week such that column 0 designates Monday, column 1 designates Tuesday, etc. The program main method populates the array with random numbers...

  • PLEASE DO THIS IN PYTHON!!! 1.) Exercise #1: Design and implement a program (name it Youth)...

    PLEASE DO THIS IN PYTHON!!! 1.) Exercise #1: Design and implement a program (name it Youth) that reads from the user an integer values repressing age (say, age). The program prints out the entered values followed by a message as follows: If age is less or equal to 21, the message is “Youth is a wonderful thing. Enjoy.”. Finally, the program always prints out the message “Age is a state of mind.” Format the outputs following the sample runs below....

  • Box 15-2 Kilocalorie Adjustment Necessary for Weight Loss 454 g (1 lb) per week there needs...

    Box 15-2 Kilocalorie Adjustment Necessary for Weight Loss 454 g (1 lb) per week there needs to be a 500 kcal To lose 454 g (1 energy deficit per day. BASIS OF ESTIMATION: 1 lb of body fat = 454 g 1 g of pure fat = 9 kcal of body fat = 7.7 kcal (differences due to water in fat cells) 254 9 x 7.7 kcal/g = 3496 kcal/454 g of body fat (or -3500 kcal) 500 kcal energy...

  • I am writing a Python program to serve as a fitness tracker. I would love some...

    I am writing a Python program to serve as a fitness tracker. I would love some input as to how you would code this. I've included what I want this program to accomplish, what I will keep track of, and below all of that I have posted the assignment guidelines. Any suggestions on how to make this better/ more efficient would be welcome! I'm thinking of making a weekly tracker that takes input per day, and outputs at the end...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT