Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA PART A. Write a program FitnessPlanner_1 that asks the user to enter his/her weight in lbs, how many chicken nuggets were eaten, average

IN JAVA

PART A. Write a program FitnessPlanner_1 that asks the user to enter his/her weight in lbs, how many chicken nuggets were eaten, average walk speed in mph (typically 3 mph, which is a 20minute mile pace), and average run speed in mph (typically 6 mph, which is a 10minute mile pace). The program should then output how long the user needs to walk and how long the user needs to run in order to burn those chicken nuggets off. Declare the calories of a chicken nugget as a global constant.

image text in transcribedimage text in transcribedimage text in transcribed

This Fitness Planner program will calculate how long **you need to exercise to burn off what you just ate. What is your weight in pounds? 125 How many chicken nuggets did you eat? 20 What is your average WALKING speed in mph (3 is typical, a 20-min/mi pace)? 3 What is your average RUNNING speed in mph (6 is typical, a 10-min/mi pace) ? 7 You need to walk for 287 minutes to burn off the 20 chicken nuggets you ate You need to run for 81 minutes to burn off the 20 chicken nuggets you ate. PART B. Make a copy of the previous program and rename the class to FitnessPlanner_2. This time, before asking the user to enter a walking or running speed, ask the user if he/she prefers walking or running by asking the user to input "W" for walking or "R" for running. You then should only ask the user to enter the walking speed OR the running speed according to the user's response to this query. Likewise, use the appropriate formula (for walking or for running). When you read the letters w/W or r/R from the user, save them as strings. The method to read a string is next(). Example Scanner keyboard new Scanner (System.in) System.out.printin ("Enter your gender: " string gender keyboard.next) ***This Fitness Planner program will calculate how long **you need to exercise to burn off what you just ate. What is your weight in pounds? 150 How many chicken nuggets did you eat? 12 Do you prefer walking or running (W or R)? What is your average WALKING speed in mph (3 is typical, a 20-min/mi pace) ? 2 You need to walk for 187 minutes to burn off the 12 chicken nuggets you ate. PART C. Make a copy of the previous program and rename the class to FitnessPlanner 3. This time, instead of asking the user how many chicken nuggets he/she ate, ask for how much time the user will have to run or walk. Your program should then tell the user how many chicken nuggets he/she is allowed to eat without accumulating surplus calories, assuming they follow through with their exercise commitment. Also display how many calories will be burned. *This Fitness Planner program will calculate how much food ** you can eat and how many calories you need to burn off. What is your weight in pounds? 115 Do you prefer walking or running (W or R) ? eed in mph (6 is typical. a 10-minimi pace)? How many minutes will you run? 30 Congratulations, you are allowed to eat 7 chicken nuggets. You will burn off 363 calories later

Step by Step Solution

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions