Advertisement
GabrielHr00

05. Journey

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