Advertisement
Guest User

journey

a guest
Oct 3rd, 2019
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.58 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class journey {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.  
  8.         double budget = Double.parseDouble(scanner.nextLine());
  9.         String sesson = scanner.nextLine();
  10.  
  11.  
  12.         double price = 0;
  13.         String destinstion = "";
  14.         String typeOfAccommodation = "";
  15.  
  16.         if (budget <= 100) {
  17.             if ("Summer".equals(sesson)) {
  18.                 price = budget*0.7;
  19.                 typeOfAccommodation = "Camp";
  20.             } else if ("Winter".equals(sesson)) {
  21.                 price = price * (1 - 0.7);
  22.                 typeOfAccommodation = "Hotel";
  23.             }
  24.             destinstion = "Bulgarian";
  25.         } else if (budget <= 1000) {
  26.             if ("Summer".equals(sesson)) {
  27.                 price = budget * (1 - 0.4);
  28.                 typeOfAccommodation = "Camp";
  29.             } else if ("Winter".equals(sesson)) {
  30.                 price = price * (1 - 0.8);
  31.                 typeOfAccommodation = "Camp";
  32.             }
  33.             destinstion = "Balkans";
  34.         } else {
  35.             if ("Summer".equals(sesson)) {
  36.                 price = budget * (1 - 0.9);
  37.                 typeOfAccommodation = "Camp";
  38.             } else if ("Winter".equals(sesson)) {
  39.                 price = price * (1 - 0.9);
  40.                 typeOfAccommodation = "Camp";
  41.             }
  42.             destinstion = "Europe";
  43.         }
  44.        
  45.         System.out.printf("Somewhere in %s",destinstion).println();
  46.         System.out.printf("%s – %.2f",typeOfAccommodation,price);
  47.  
  48.  
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement