Advertisement
Spocoman

05. Vacation

Aug 26th, 2024
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Vacation {
  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 location = "", place = "";
  10.  
  11.         if (season.equals("Summer")) {
  12.             location = "Alaska";
  13.         } else {
  14.             location = "Morocco";
  15.         }
  16.  
  17.         if (budget > 3000) {
  18.             place = "Hotel";
  19.             budget *= 0.90;
  20.         } else if (budget > 1000) {
  21.             if (season.equals("Summer")) {
  22.                 budget *= 0.80;
  23.             } else {
  24.                 budget *= 0.60;
  25.             }
  26.             place = "Hut";
  27.         } else if (budget > 0) {
  28.             if (season.equals("Summer")) {
  29.                 budget *= 0.65;
  30.             } else {
  31.                 budget *= 0.45;
  32.             }
  33.             place = "Camp";
  34.         }
  35.         System.out.printf("%s - %s - %.2f\n", location, place, budget);
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement