Advertisement
myrdok123

05. Journey

Jan 21st, 2024
866
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.47 KB | None | 0 0
  1. package W03ConditionalStatementsAdvanced.Exercise;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P05Journey {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.         double budget = Double.parseDouble(scanner.nextLine());
  11.         String season = scanner.nextLine();
  12.  
  13.         double spendMoney = 0;
  14.         String destination = "";
  15.         String accommodationType = "";
  16.  
  17.         //Проверка колко бюджета и съответно какъв е созона
  18.         if(budget <= 100 && season.equals("summer")){
  19.             destination = "Bulgaria";
  20.             accommodationType = "Camp";
  21.             spendMoney = budget * 0.3;
  22.  
  23.         }else if (budget <= 100){
  24.             destination = "Bulgaria";
  25.             accommodationType = "Hotel";
  26.             spendMoney = budget * 0.7;
  27.  
  28.         } else if (budget <= 1000 && season.equals("summer")){
  29.             destination = "Balkans";
  30.             accommodationType = "Camp";
  31.             spendMoney = budget * 0.4;
  32.  
  33.         } else if (budget <= 1000) {
  34.             destination = "Balkans";
  35.             accommodationType = "Hotel";
  36.             spendMoney = budget * 0.8;
  37.  
  38.         }else {
  39.             destination = "Europe";
  40.             accommodationType = "Hotel";
  41.             spendMoney = budget * 0.9;
  42.         }
  43.  
  44.         System.out.println("Somewhere in " + destination);
  45.         System.out.printf("%s - %.2f", accommodationType, spendMoney);
  46.     }
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement