Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.20 KB | None | 0 0
  1.     public static void main(String[] args) {
  2.         Scanner scanner = new Scanner(System.in);
  3.         //•   Първи ред – Бюджет, реално число в интервала [10.00...5000.00].
  4.         //•   Втори ред –  Един от двата възможни сезона: „summer” или “winter”
  5.  
  6.         System.out.println("Бюджет: ");
  7.         double budget = Double.parseDouble(scanner.nextLine());
  8.         System.out.println("Сезон: ");
  9.         String season = scanner.nextLine();
  10.  
  11.         String destination;
  12.         String restIn = season.equals("summer") ? "camp" : "hotel";
  13.         double spendBudget;
  14.  
  15.         if (budget <= 100) {
  16.             spendBudget = budget *= season.equals("winter") ? 0.7 : 0.3;
  17.             destination = "Bulgaria";
  18.         } else if (budget > 100 && budget <= 1000) {
  19.             spendBudget = budget *= season.equals("winter") ? 0.8 : 0.4;
  20.             destination = "Balkans";
  21.         } else {
  22.             spendBudget = budget * 0.9;
  23.             destination = "Europe";
  24.         }
  25.         System.out.printf("Somewhere in %s %n", destination);
  26.         System.out.printf("%s - %.2f", restIn, spendBudget);
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement