77 961
Assignments Done
Successfully Done
In August 2019

Answer to Question #17130 in Java | JSP | JSF for Sayed Abdullah Almousawi

Question #17130
At the State Fair Pie Eating Contest all contestants in the heavyweight
division must weigh within 30 pounds of 250 pounds. Write a program that asks for a
contestant's weight and then says if the contestant is allowed in the contest.
Expert's answer
import java.util.Scanner;

public class Test {

public static void main(String[] args) {

Scanner console = new Scanner(System.in);

System.out.println("Enter your weight in pounds, please: ");

String temp = console.next();

int weight = Integer.parseInt(temp);

if (weight >= 30 && weight <= 250) {

System.out.println("You're allowed in the contest");

} else

System.out.println("You're NOT allowed in the contest");



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions