Advertisement
Guest User

journey

a guest
Jan 29th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.71 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         double budget = Double.parseDouble(scanner.nextLine());
  10.         String season = scanner.nextLine();
  11.  
  12.         double moneySpent = 0.0;
  13.         String destination = "";
  14.         String holiday = "";
  15.  
  16.         switch (season) {
  17.             case "summer":
  18.                 if(budget <= 100) {
  19.                     moneySpent = 0.3;
  20.                     destination = "Bulgaria";
  21.                     holiday = "Camp";
  22.                 }else if(budget <= 1000) {
  23.                     moneySpent = 0.4;
  24.                     destination = "Balkans";
  25.                     holiday = "Camp";
  26.                 }else if(budget > 1000) {
  27.                     moneySpent = 0.9;
  28.                     destination = "Europe";
  29.                     holiday = "Hotel";
  30.                 }
  31.                 break;
  32.  
  33.             case "winter":
  34.                 holiday = "Hotel";
  35.  
  36.                 if(budget <= 100) {
  37.                     moneySpent = 0.7;
  38.                     destination = "Bulgaria";
  39.                 }else if(budget <= 1000) {
  40.                     moneySpent = 0.8;
  41.                     destination = "Balkans";
  42.                 }else if(budget > 1000) {
  43.                     moneySpent = 0.9;
  44.                     destination = "Europe";
  45.                 }
  46.                 break;
  47.         }
  48.  
  49.         if(season.equals("summer") || season.equals("winter") && budget != 0) {
  50.             System.out.println("Somewhere in " + destination);
  51.             System.out.println(holiday + " - " + String.format("%.2f",budget * moneySpent));
  52.         }
  53.         scanner.close();
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement