Ask Question

Get user input as a boolean and store it in the variable tallEnough. Also, get user input as a boolean and store it in the variable oldEnough. Then, use the two boolean variables to decide whether the user is able to ride the rollercoaster. The only time the user can ride the rollercoaster is if the responses to both answers is true. Use a logical operator to decide whether the user is eligible to ride. Print true or false depending on whether the user can or can't ride the rollercoaster.

+3
Answers (1)
  1. 19 October, 01:34
    0
    I will code in JAVA.

    import java. util. Scanner;

    public class Main {

    public static void main (String[] args) {

    boolean tallEnough;

    boolean oldEnough;

    Scanner input = new Scanner (System. in);

    tallEnough = input. nextBoolean (); / /wait the input for tallEnough

    oldEnough = input. nextBoolean (); / /wait the input for OldEnough

    if (tallEnough && oldEnough) {

    System. out. print (true);

    } else {

    System. out. print (false);

    }

    }

    }

    Explanation:

    First, to accept user inputs you have to import the class Scanner. Then declare both variables before allowing the user to set input values for both boolean variables.

    In the if-else statement checks if both variables are true, then prints true. Another case prints always false.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Get user input as a boolean and store it in the variable tallEnough. Also, get user input as a boolean and store it in the variable ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers