tianadevoe1148 tianadevoe1148
  • 18-01-2020
  • Computers and Technology
contestada

Write an if-else statement that displays 'Speed is normal' if the speed variable is within the range of 24 to 56. If the speed variable’s value is outside this range, display 'Speed is abnormal'.

Respuesta :

SyntaxError
SyntaxError SyntaxError
  • 18-01-2020

Answer:

import java.util.Scanner;

public class Speed{

int speed;

public Speed(int speed){

this.speed = speed;

}

public void checkSpeed(){

if(speed >= 24 || speed <= 56){

System.out.println("Speed is normal");

}

else

System.out.println("Speed is abnormal");

}

public static void main(String...args){

Scanner input = new Scanner(System.in);

int userSpeed = 0;

System.out.println("Enter a speed: ");

userSpeed = input.nextInt();

Speed obj1 = new Speed(userSpeed)

obj1.checkSpeed();

}

Explanation:

Answer Link

Otras preguntas

Find the x intercepts of y=2x^2+x-21
Evaluate the following expression using the values given:Find -3a2 - b3 + 3c2 - 2b3 if a = 2, b = -1, and c = 3.
What were the first-known inhabitants of massachusetts?
Describe something that you think is a public good. Explain how it is non-excludable and non-rival. State whether you think the good should be provided by the g
What does this example of personification mean?"The funeral raced by me in a blur."
why is no dew formed on a windy day or when the sky is cloudy?
to the nearest tenth of a percent, what is 8/13 written as a percent? Answers: A. 0.6%
What did Robert e lee have to do with the civil war
Which syllable is most strongly accented? Underdog, sophisticated, terminate,
How many syllables are in procrastinate? Which syllable is most strongly accented?