Extend the RecommendedWeightWithTest program in Exercise 12 by allowing the user to enter his or her weight and printing out the message You should exercise more if the weight is more than 10 lb over the ideal weight and You need more nourishment if the weight is more than 20 lb under the recommended weight.
Reference Exercise 12:
Write a program RecommendedWeightWithTest by extending the RecommendedWeight (see Exercise 8 on page 209). The extended program will include the following test:
if (the height is between 140cm and 230cm)
compute the recommended weight
else
display an error message
Reference Exercise 8:
Rewrite the following if statement, using a switch statement.
selection = scanner.nextInt( );
if (selection == 0)
System.out.println("You selected Magenta");
else if (selection == 1)
System.out.println("You selected Cyan");
else if (selection == 2)
System.out.println("You selected Red");
else if (selection == 3)
System.out.println("You selected Blue");
else if (selection == 4)
System.out.println("You selected Green");
else
System.out.println("Invalid selection");
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.