Advertisement
Guest User

Untitled

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