Question
// // This class generates a Boolean OR result from an integer comparison // OR'd with a Boolean. It models the English statement slow down
// // This class generates a Boolean OR result from an integer comparison // OR'd with a Boolean. It models the English statement "slow down if // your speed is over the limit OR if there's a crash." class Main { // Take user speed and isCrash boolean, combine to output the // command to slow down (or not). public static void main(String[] args) { java.util.Scanner scan = new java.util.Scanner(System.in); System.out.println("Please enter a speed (int) and isCrash (true or false):"); int speedLimit = 35; int speed = scan.nextInt(); boolean isCrash = scan.nextBoolean(); boolean isSlowDown; // TODO: complete the expression for -- "set isSlowDown to true when you're over // the speed limit or there is a crash, and false otherwise". isSlowDown = System.out.println("speed = " + speed); System.out.println("speedLimit = " + speedLimit); System.out.println("isCrash = " + isCrash); System.out.println("isSlowDown = " + isSlowDown); } }
On line 12:
Complete the expression to set isSlowDown to true when your speed is over the speed limit OR there is a crash, otherwise set it to false.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started