YavorGrancharov

ExamTask3(Vacation)

Mar 19th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.89 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ExamTask3 {
  4.     public static void main(String[] args) {
  5.         Scanner console = new Scanner(System.in);
  6.         double budget = Double.parseDouble(console.nextLine());
  7.         String season = console.nextLine();
  8.  
  9.         if(budget <= 1000) {
  10.             double price = 0.0;
  11.             String camp = "Camp";
  12.             if(season.equals("Summer")) {
  13.                 String destination = "Alaska";
  14.                 price = budget * 0.65;
  15.                 System.out.printf("%s - %s - %.2f",destination,camp,price);
  16.             } else if(season.equals("Winter")) {
  17.                 String destination = "Morocco";
  18.                 price = budget * 0.45;
  19.                 System.out.printf("%s - %s - %.2f",destination,camp,price);
  20.             }
  21.         }
  22.  
  23.         if(budget > 1000 && budget <= 3000) {
  24.             double price = 0.0;
  25.             String camp = "Hut";
  26.             if(season.equals("Summer")) {
  27.                 String destination = "Alaska";
  28.                 price = budget * 0.8;
  29.                 System.out.printf("%s - %s - %.2f",destination,camp,price);
  30.             } else if(season.equals("Winter")) {
  31.                 String destination = "Morocco";
  32.                 price = budget * 0.6;
  33.                 System.out.printf("%s - %s - %.2f",destination,camp,price);
  34.             }
  35.         }
  36.  
  37.         if(budget > 3000) {
  38.             double price = 0.0;
  39.             String camp = "Hotel";
  40.             if(season.equals("Summer")) {
  41.                 String destination = "Alaska";
  42.                 price = budget * 0.9;
  43.                 System.out.printf("%s - %s - %.2f",destination,camp,price);
  44.             } else if(season.equals("Winter")) {
  45.                 String destination = "Morocco";
  46.                 price = budget * 0.9;
  47.                 System.out.printf("%s - %s - %.2f",destination,camp,price);
  48.             }
  49.         }
  50.     }
  51. }
Add Comment
Please, Sign In to add comment