Answered You can hire a professional tutor to get the answer.

QUESTION

atLeast1 0 Expected result false 150 50.5 false false 90 50.5 false true 150 50.5 true true 90 50.5 false true 180 120.0 true true 200 120.0 false...

import java.util.Scanner; public class GateKeeper {

public static boolean canBoard(boolean param1, int p2, double i_forget) { final int constant = 120; final int maX = 196; final double MASS = 200; boolean out; out = false; if (param1 && i_forget < MASS ) { if (p2 <= constant || p2 >= maX) { out = true; } } return out; }

public static void main(String[] args) {

 Scanner sc = new Scanner(System.in);

  String again;

 boolean atLeast10; int height; double weight;

System.out.println("ROLLER COASTER GATE KEEPER");

do { System.out.print("Are you at least 10 years old (true/false)? "); atLeast10 = sc.nextBoolean();

System.out.print("Height (whole cm): "); height = sc.nextInt();

System.out.print("Weight (to nearest half kg): "); weight = sc.nextDouble();

if (canBoard(atLeast10, height, weight)) { System.out.println("Welcome aboard"); } else { System.out.println("Sorry you may not board"); }

System.out.print("Process another person (y/n)? "); again = sc.next(); } while(again.equals("y"));

} }

restructure

atLeast1 0 Expected resultfalse 150 50.5 false false 90 50.5 false true 150 50.5 true true 90 50.5 false true 180 120.0 true true 200 120.0 false true 180 201 .5 false
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question