Advertisement
SvetlanPetrova

Journey SoftUni

Apr 19th, 2021
947
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.47 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Journey {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double budget = Double.parseDouble(scanner.nextLine());
  7.         String season = scanner.nextLine();
  8.  
  9.         String accommodation = "";
  10.         String destination = "";
  11.         double spend = 0;
  12.  
  13.         if (budget <= 100) {
  14.             destination = "Bulgaria";
  15.             switch (season) {
  16.                 case "summer":
  17.                     spend = budget * 0.30;
  18.                     accommodation = "Camp";
  19.                     break;
  20.                 case "winter":
  21.                     spend = budget * 0.70;
  22.                     accommodation = "Hotel";
  23.                     break;
  24.             }
  25.         }
  26.         else if (budget <= 1000) {
  27.             destination = "Balkans";
  28.             switch (season) {
  29.                 case "summer":
  30.                     spend = budget * 0.40;
  31.                     accommodation = "Camp";
  32.                     break;
  33.                 case "winter":
  34.                     spend = budget * 0.80;
  35.                     accommodation = "Hotel";
  36.                     break;
  37.             }
  38.         }
  39.         else if (budget > 1000) {
  40.            destination = "Europe";
  41.            spend = budget * 0.90;
  42.            accommodation = "Hotel";
  43.         }
  44.  
  45.         System.out.printf("Somewhere in %s", destination);
  46.         System.out.printf("%n%s - %.2f", accommodation, spend);
  47.     }
  48. }
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement