bartleby

Videos

Textbook Question
Book Icon
Chapter 3, Problem 10PP

Repeat Programming Project 13 from Chapter 2 but in addition ask the user if he or she is:

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.

Blurred answer
Students have asked these similar questions
Write a program that can suggest an activity based on the temperature. If the temperature is between 20 to 40 degrees Fahrenheit, suggest the user go skiing; if the temperature is between 41 to 60 degrees Fahrenheit, suggest the user go hiking; if the temperature is in the range of 61 to 80, suggest swimming. For all the temperatures out of these ranges (too cold or too hot), then suggest staying inside.
Write a program that will figure out the required change for a purchase. Start by asking the user for the price of the product and the amount paid. (We are expecting that the user will give a larger value for the amount paid.) Read in each of these values as a double. Report back to the user the number of each denomination of change due.  You are not just telling the user the amount of money he gets back. Hint: Working with integers is much easier. The modulo operator is your friend for this assignment. Also, note that pennies can be tricky due to the poor real number to binary conversions. (Remember that 1.00 could actually be stored as 0.9999999999997.) Do not include five-dollar bills, ten-dollar bills, etc. Only show coins and one-dollar bill amounts. Be sure to test multiple values. There is a test case below.  Your program should run the test case exactly as it appears below, and should work on any other case in general. Output Example (User input is marked with >>>.…
Write a program that calculates a weekly wage, based on an hourly payrate and how many hours were worked; then amounts for various categories of spending need calculated, along with how much of the weekly pay is leftover. • Tax = 15% • Shopping = 20% • Entertainment = 10% • Savings = 25% • Remainder = 30% (or you could subtract to find what’s left) In c++

Chapter 3 Solutions

Problem Solving with C++, Student Value Edition plus MyProgrammingLab with Pearson eText -- Access Card Package (9th Edition)

Ch. 3.2 - What output will be produced by the following...Ch. 3.2 - Write a multiway if-else statement that classifies...Ch. 3.2 - Given the following declaration and output...Ch. 3.2 - Given the following declaration and output...Ch. 3.2 - What output will be produced by the following...Ch. 3.2 - What would be the output in Self-Test Exercise 15...Ch. 3.2 - What would be the output in Self-Test Exercise 15...Ch. 3.2 - What would be the output in Self-Test Exercise 15...Ch. 3.2 - Prob. 19STECh. 3.2 - Though we urge you not to program using this...Ch. 3.3 - Prob. 21STECh. 3.3 - Prob. 22STECh. 3.3 - What is the output of the following (when embedded...Ch. 3.3 - What is the output of the following (when embedded...Ch. 3.3 - Prob. 25STECh. 3.3 - What is the output of the following (when embedded...Ch. 3.3 - Prob. 27STECh. 3.3 - For each of the following situations, tell which...Ch. 3.3 - Rewrite the following loops as for loops. a.int i...Ch. 3.3 - What is the output of this loop? Identify the...Ch. 3.3 - What is the output of this loop? Comment on the...Ch. 3.3 - What is the output of this loop? Comment on the...Ch. 3.3 - What is the output of the following (when embedded...Ch. 3.3 - What is the output of the following (when embedded...Ch. 3.3 - What does a break statement do? Where is it legal...Ch. 3.4 - Write a loop that will write the word Hello to the...Ch. 3.4 - Write a loop that will read in a list of even...Ch. 3.4 - Prob. 38STECh. 3.4 - Prob. 39STECh. 3.4 - What is an off-by-one loop error?Ch. 3.4 - You have a fence that is to be 100 meters long....Ch. 3 - Write a program to score the paper-rock-scissor...Ch. 3 - Write a program to compute the interest due, total...Ch. 3 - Write an astrology program. The user types in a...Ch. 3 - Horoscope Signs of the same Element are most...Ch. 3 - Write a program that finds and prints all of the...Ch. 3 - Buoyancy is the ability of an object to float....Ch. 3 - Write a program that finds the temperature that is...Ch. 3 - Write a program that computes the cost of a...Ch. 3 - (This Project requires that you know some basic...Ch. 3 - Write a program that accepts a year written as a...Ch. 3 - Write a program that scores a blackjack hand. In...Ch. 3 - Interest on a loan is paid on a declining balance,...Ch. 3 - The Fibonacci numbers F are defined as follows. F...Ch. 3 - The value ex can be approximated by the sum 1 + x...Ch. 3 - Prob. 8PPCh. 3 - Prob. 9PPCh. 3 - Repeat Programming Project 13 from Chapter 2 but...Ch. 3 - The keypad on your oven is used to enter the...Ch. 3 - The game of 23 is a two-player game that begins...Ch. 3 - Holy digits Batman! The Riddler is planning his...
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY