Advertisement
cgorrillaha

Lazy Days

Nov 2nd, 2020
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Main {
  4.   public static void main(String[] args) {
  5.     Scanner scan = new Scanner(System.in);
  6.     int temp;
  7.     String activity = "";
  8.  
  9.     // input temperature
  10.     System.out.println("Please enter the temperature:");
  11.     temp = scan.nextInt();
  12.  
  13.     // suggest activity
  14.     /*
  15.      * temp >= 80: swimming
  16.      60 <= temp < 80: tennis
  17.      40 <= temp < 60: golf
  18.      temp < 40: skiing
  19.      */
  20.     if (temp >= 90 || temp <= 20) {
  21.       activity = "visit our shops";
  22.     } else {
  23.       if (temp >= 80) {
  24.         activity = "Go swimming.";
  25.       } else if (temp >= 60) {
  26.         activity = "Play tennis.";
  27.       } else if (temp >= 40) {
  28.         activity = "Play golf.";
  29.       } else {
  30.         activity = "Go skiing.";
  31.       }
  32.     }
  33.  
  34.     //output results
  35.     System.out.println(activity);
  36.   }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement