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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!