Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.*; public class Main{ public static void main(String[] args) { // creating a Scanner Object Scanner input = new Scanner(System.in); // variable to store

import java.util.*;

public class Main{ public static void main(String[] args) { // creating a Scanner Object Scanner input = new Scanner(System.in); // variable to store weight, height and age double weight,height,age; // prompt for weight System.out.print("Enter your Weight(in pounds):"); // reading weight weight=input.nextDouble(); // prompt for Height System.out.print("Enter your Height(in inches):"); // reading height height=input.nextDouble(); //prompt for Age System.out.print("Enter your Age(in years): "); // reading age age=input.nextDouble(); // calculating Women_BMR double Women_BMR = 655 + (4.3*weight) + (4.7*height)- (4.7*age); // calculating Man_BMR double Man_BMR = 66 + (6.3*weight) + (12.9*height) -(6.8*age); // A variable to store calories per chocolate double Chocolate_Bar_calories=230; // calculating number of chocolates for Women doubleWomen_chocolates=Women_BMR/Chocolate_Bar_calories; // calculating number of chocolates for Man double Man_chocolates =Man_BMR/Chocolate_Bar_calories; // printing chocolate required for Women System.out.printf("Chocolates required for Women are%.1f",Women_chocolates); //printing chocolates required for Man System.out.printf("Chocolates required for Man are%.1f",Man_chocolates);

}}

Modify the above program to allow user to input theirheight in feet and weight in kilograms. For instance, the height is5.7 feet and weight is 90.4 kg. Your program will first convert theheight from feet to inches and weight from kg to lbs., and thenwill compute the BMR.

Example

image

This program will calculate the number of 230 calorie candy bars to eat to maintain your weight. What is your age in years? 34 what is your total height in feet? 5.7 What is your weight in kilograms? 90.4 A female with those measurements should eat 8.57805043478261 candy bars per day to maintain her weight. A male with those measurements should eat 7.277424347826887 candy bars per day to maintain his weight.

Step by Step Solution

3.45 Rating (165 Votes )

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

Recommended Textbook for

Introduction to Java Programming, Comprehensive Version

Authors: Y. Daniel Liang

10th Edition

133761312, 978-0133761313

More Books

Students also viewed these Electrical Engineering questions

Question

Psychological issues associated with officiating/refereeing

Answered: 1 week ago

Question

Describe how an operations strategy is formulated.

Answered: 1 week ago