Advertisement
veronikaaa86

06. Speed Info

May 20th, 2023
737
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. package conditionalStatementsLab;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P06SpeedInfo {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         double speed = Double.parseDouble(scanner.nextLine());
  10.  
  11.         String resultText = "";
  12.        
  13.         if (speed <= 10) {
  14.             resultText = "slow";
  15.         } else if (speed <= 50) {
  16.             resultText = "average";
  17.         } else if (speed <= 150) {
  18.             resultText = "fast";
  19.         } else if (speed <= 1000) {
  20.             resultText = "ultra fast";
  21.         } else {
  22.             resultText = "extremely fast";
  23.         }
  24.  
  25.         System.out.println(resultText);
  26.     }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement