System out-println(\"This program will caleulate the number of 230 calorie\") Sy
ID: 3751126 • Letter: S
Question
System out-println("This program will caleulate the number of 230 calorie") System.out.println ("candy bars to eat to maintain your weight. System.out println ("What is your age in years?") age = keyboard.nextInt(); System.out printin("What is your total height in inches? height keyboard. nextInt ) System.out.println ("What is your weight in pounds?"); weight keyboard.nextint(); System.out println ("Enter for male calculation or 'F' Eor female calculation.); maier Female = keyboard, next(); double calories f (maleOrFemale.equals(M calories 655(4.3weight) (4.7height)(4.7 age); System.out.printin("A male with those measurements should eat" (calories 230)+ " candy bars per day to maintain her weight.") else if (maleOrFemale.equals ("F") calories 66(.3 weight) + (12.9 height)(6.8age); System-out-PrantIn(" female with those me asurement, should eat " + (calories /230) + " candy bars per day to maintain hez weäght.") else System.out-printin ("Invalid entry") Give the output for the following inputs: a) 25 b) 46 c) 18 70 65 50 150 200Explanation / Answer
a)
25 70 150 M
output is:
A male with those measurements should eat 6.571739130434783 candy bars per day to maintain her weight.
explanation:
since , maleorfemale variable VALUE is M , first if condition is satisfied
b)
46 65 200 F
ouput
A female with those measurements should eat 8.050869565217392 candy bars per day to maintain her weight.
explanation:
since , maleorfemale variable VALUE is F , first elsif condition is satisfied
c)
18 50 60 K
output:
Invalid entry
explanation:
since , maleorfemale variable VALUE is K , first two conditions failed, so else executed
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.