Repeat
a. Sedentary
b. Somewhat active (exercise occasionally)
c. Active (exercise 3–4 days per week)
d. Highly active (exercise every day)
If the user answers “Sedentary,” then increase the calculated BMR by 20
percent. If the user answers “Somewhat active,” then increase the
calculated BMR by 30 percent. If the user answers “Active,” then increase
the calculated BMR by 40 percent. Finally, if the user answers “Highly
active,” then increase the calculated BMR by 50 percent. Output the
number of chocolate bars based on the new BMR value.
13. 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 formula for the calories needed for a woman to maintain her weight is BMR=655+(4.3×weight in pounds)+(4.7×height in inches)−(4.7×age in years) The formula for the calories needed for a man to maintain his weight is BMR=66+(6.3×weight in pounds)+(12.9×height in inches)−(6.8×age in years) A typical chocolate bar will contain around 230 calories. Write a program that allows the user to input his or her weight in pounds, height in inches, age in years, and the character M for male and F for female. The program should then output the number of chocolate bars that should be consumed to maintain one’s weight for the appropriate sex of the specified weight, height, and age.
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Database Concepts (8th Edition)
SURVEY OF OPERATING SYSTEMS
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Starting Out with C++ from Control Structures to Objects (9th Edition)
Mechanics of Materials (10th Edition)
- C languagearrow_forwardPYTHON PROGRAMMINGarrow_forwardTASK " Write a program that grades students' exam. The exam has 20 multiple choice questions. Here are the correct answers: 1- A 6- B 11-C 16- D 2- A 7- B 12- C 17- D 3- А 8- В 13-С 18- D 4- А 9- В 14- С 19- D 5- A 10-B 15- C 20- D "A student must correctly answer 15 of the 20 questions to pass the exam. " Write a class named StudentExam that holds the correct answers to the exam in an array. TASK (CONT.) " The class should also have an array that holds the student's answers. The class also should have the following methods: I passed. Returns true if the student passed the exam, or false if the student failed " totalCorrect. Returns the total number of correctly answered questions I totallncorrect. Returns the total number of incorrectly answered questions " questionsMissed. An int array containing the question numbers of the questions that the student missed. 1 On another class, ask the student to enter his name, take his answers and display the results returned from the StudentExam…arrow_forward
- Please answer in matlab code.arrow_forwardUse C language in creating this programarrow_forward2. Write a program that determines a student's grade. The program will read three scores and determine the grade based on the following rules: -if the average score >=90% and grade=A -if the average score >= 70% and grade=B -if the average score>=50% and grade=C -if the average scoregrade=Farrow_forward
- 1.Write a program to determine whether a number is a deficient number or not. A number is deficient number as the sum of its factors (1+3+5+15=24) is less than 30 (double of 15). On the other hand, 24 is not a deficient number. Because the sum of the factors of 24 (1,2,3,4,6,8,12,24) is 60 which is larger than double of 24. 2.Manually trace(show the values of all the variables in each step) the following code segment. int n=5,sum=0,i,a=3,sign=1; for(i=1;iarrow_forwardWrite a program that reads student scores, gets the best score, and hence assigns grades based on the following scheme: Grade is A if score is > = best - 10; Grade is B if score is > = best - 20; Grade is C if score is > = best - 30; Grade is D if score is > = best - 40; Grade is F otherwise. The program prompts the user to enter the total number of students, then prompts the user to enter all of the scores, and concludes by displaying the grades. Language: C++arrow_forwardWrite a C++ program that will ask for a number which will determine the grading system. If the number is between 90 and 100, display "Excellent". If the number is between 80 and 91, display "Well done". If the number is between 70 and 81, display "Good". If the number is between 60 and 71, display "Better luck next time". If the number is between 50 and 61, display "Needs more effort". If the number is between 0 and 50, display "Failed".arrow_forward
- Interest on a credit card’s unpaid balance is calculated using the average daily balance. Suppose that netBalanceis the balance shown in the bill, paymentis the payment made, d1is the number of days in the billing cycle, and d2is the number of days payment is made before the billing cycle. Then the average daily balance is: averageDailyBalance = (netBalance * d1 –payment * d2) / d1 if the interest rate per month is say, 0.0152, then the interest on the unpaid balanceis: interest = averageDailyBalance * 0.0152 Design a program that accepts as input netBalance, payment, d1, d2, and interest rate per month. The program outputs the interest charged. Format your output to two decimal places. C++arrow_forwardUsing C Languagearrow_forwardwrite a C++program that finds the total amount to be spent on a vacation. In Main ask the user for the number of days for the trip and the name of the person booking the trip. It should then call FindHotelCost() and pass both of these variables to that function. The FindHotelCost() function should give a message using the persons name who is booking the trip with the hotel bill. The bill will be 550 dollars for each day of the trip. It should then call AddRentalCar() and pass the name and number of days and the hotel bill to that function AddRentalCar() asks the user for the number of miles that were driven on the rental car and calculates the price of the car. It is $50 per day and .08 cents per mile driven. Show this charge to the user and then add it to the hotel bill for the total bill for the stay. Show this total to the user as well with the person’s name booking the trip.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning