Question

QUESTION2 Write a Java program for the following problem: Imagine you are the coach in the gym. You have to suggest the exercises, weights and running according to the height and weight of the customer. Here is the suggestions: height weight 200 to 250E Suggestion Cycle 30 minutes, walker 20 minutes, weight upto 50 pounds 10 minutes Cycle 20 minutes, walker 20 minutes, weight upto 40 pounds 10 minutes Cycle 20 minutes, walker 10 minutes, weight 30 pounds 10 minutes 6 feet or higher 5 to 5.9 feet 150 to 249.99 Less than 5 feet 100 to 149.99 Ask the customer his height and weight and suggest the corresponding exercise. If the height and weight combinations that user gives does not fall under the above limits suggest that the customer has to visit the doctor for health checkup.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.util.*;
public class MyClass {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int cycle =0,walk=0,weigh=0;
        double height, weight;
        boolean Doc=true;
        System.out.print("Enter height: ");
        height=sc.nextDouble();
        System.out.print("Enter weight: ");
        weight=sc.nextDouble();
        if(height>=6 && weight>=200 && weight<=250){
            cycle=30;
            walk=20;
            weigh=50;
            Doc=false;
        }
        else if(height>=5 && height <=5.9 && weight>=150 && weight<250){
            cycle=20;
            walk=20;
            weigh=40;
            Doc=false;
        }
        else if(height<5 && weight>=100 && weight<150){
            cycle=20;
            walk=10;
            weigh=30;
            Doc=false;
        }
        if (Doc==true){
            System.out.println("Please visit the doctor for health checkup");
        }
        else{
            System.out.println("Cycle "+cycle+" minutes, walk "+walk+" minutes, weight upto "+weigh+" pounds 10 minutes");
        }
    }
}

Add a comment
Know the answer?
Add Answer to:
QUESTION2 Write a Java program for the following problem: Imagine you are the coach in the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT