In: Computer Science
create a program that asks the user’s height
Code:
package assignment;
import java.util.Scanner;
public class Height {
public static void main(String[] args) {
Scanner sc=new
Scanner(System.in);
System.out.println("What is your
height? ");
int n=sc.nextInt();
if(n>=5) {//is greater than or
equal to five
System.out.println("Yay! You can get on the rides alone");
}
else if(n<5 && n>4)
{// is less than five and greater than four
System.out.println("You must be accompanied by an adult");
}
else {
System.out.println("Sorry you're not allowed on the rides");
}
}
}
Note:***I hope your happy with my answer***If you have any doubts please comment me*****Thank you.......