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

what is the phenotype of a heterozygous person using T for tall and t for short
what is the phenotype of a heterozygous person using T for tall and t for short
which process breaks down sugars to make atp when oxygen is present
Dennis had a piece of rope that was 2.7 m long. He cut the rope into 3 equal pieces. Was each piece of rope greater than or less than 1 m?
please solve the following equation. x-6x=56
How do you use implicit differentiation to find x^2+3xy+y^3=10
What military strategy defeated Cornwallis at Yorktown?
Why did the slogan Peace Land and Bread appeal to the Russian people?
Dennis had a piece of rope that was 2.7 m long. He cut the rope into 3 equal pieces. Was each piece of rope greater than or less than 1 m?
How do you use implicit differentiation to find x^2+3xy+y^3=10