hpilo

Chapter2_SyntaxA_Ex8

Dec 15th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /*  ==================================================
  4.       Chapter 2: Syntax section A- conditional clause
  5.  
  6.                Ex8: Lilliput Night Race
  7.     ===================================================
  8. */
  9.  
  10. public class MyProgram {
  11.     public static void main(String[] args) {
  12.  
  13.         //variables
  14.         final int HEAT_A=50;
  15.         final int HEAT_B=60;
  16.  
  17.         int userHeat;
  18.         Scanner s=new Scanner(System.in);
  19.  
  20.         //user input
  21.         System.out.println("\nWhat is your goal? ");
  22.         userHeat=s.nextInt();
  23.  
  24.         //check input display message
  25.         if(userHeat<=HEAT_A)
  26.             System.out.println("Heat A");
  27.         else if(userHeat<=HEAT_B)
  28.             System.out.println("Heat B");
  29.         else
  30.             System.out.println("Heat C");
  31.  
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment