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.