Advertisement
Guest User

Untitled

a guest
Nov 17th, 2020
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.78 KB | None | 0 0
  1. package ConditionalStatementsAdvanced.Exercise;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class SummerOutfit {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         int degrees = Integer.parseInt(scanner.nextLine());
  9.         String timeOfDay = scanner.nextLine();
  10.  
  11.         String outfit = " ";
  12.         String shoes = " ";
  13.  
  14.  
  15.         if (degrees >= 10 && degrees <= 18) {
  16.             if (timeOfDay.equals("Morning")) {
  17.                 outfit = "Sweatshirt";
  18.                 shoes = "Sneakers";
  19.             } else if (timeOfDay.equals("Afternoon")) {
  20.                 outfit = "Shirt";
  21.                 shoes = "Moccasins";
  22.             } else if (timeOfDay.equals("Evening")) {
  23.                 outfit = "Shirt";
  24.                 shoes = "Moccasins";
  25.             }
  26.         } else if (degrees > 18 && degrees <= 24) {
  27.             if (timeOfDay.equals("Morning")) {
  28.                 outfit = "Shirt";
  29.                 shoes = "Moccasins";
  30.             } else if (timeOfDay.equals("Afternoon")) {
  31.                 outfit = "T-Shirt";
  32.                 shoes = "Sandals";
  33.             } else if (timeOfDay.equals("Evening")) {
  34.                 outfit = "Shirt";
  35.                 shoes = "Moccasins";
  36.             }
  37.         }else if (degrees >= 25) {
  38.             if (timeOfDay.equals("Morning")) {
  39.                 outfit = "T-Shirt";
  40.                 shoes = "Sandals";
  41.             } else if (timeOfDay.equals("Afternoon")) {
  42.                 outfit = "Swim Suit";
  43.                 shoes = "Barefoot";
  44.             } else if (timeOfDay.equals("Evening")) {
  45.                 outfit = "Shirt";
  46.                 shoes = "Moccasins";
  47.             }
  48.         }
  49.  
  50.         System.out.printf("It's %d degrees, get your %s and %s.", degrees, outfit, shoes);
  51.  
  52.     }
  53. }
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement