Advertisement
uktcar

03.2.05Journey

Mar 17th, 2023
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.20 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ex05Journey {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double budget = Double.parseDouble(scanner.nextLine());
  8.         String season = scanner.nextLine();
  9.  
  10.         String destination = "";
  11.         String roomKind = "";
  12.  
  13.         if (budget <= 100) {
  14.             destination = "Bulgaria";
  15.             if (season.equals("summer")) {
  16.                 budget *= 0.3;
  17.                 roomKind = "Camp";
  18.             } else if (season.equals("winter")) {
  19.                 budget *= 0.7;
  20.                 roomKind = "Hotel";
  21.             }
  22.         } else if (budget <= 1000) {
  23.             destination = "Balkans";
  24.             if (season.equals("summer")) {
  25.                 budget *= 0.4;
  26.                 roomKind = "Camp";
  27.             } else if (season.equals("winter")) {
  28.                 budget *= 0.8;
  29.                 roomKind = "Hotel";
  30.             }
  31.         } else {
  32.             destination = "Europe";
  33.             budget *= 0.9;
  34.             roomKind = "Hotel";
  35.         }
  36.  
  37.         System.out.println("Somewhere in " + destination);
  38.         System.out.printf("%s - %.2f", roomKind, budget);
  39.     }
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement