borkins

Exam 26-Mar-2016 - 03. Trip

May 14th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.22 KB | None | 0 0
  1. /**
  2.  * Project: Exam_26_March_2016 - created by borkins on 2017-05-14.
  3.  */
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class _03_Trip
  8. {
  9.     public static void main(String[] args)
  10.     {
  11.         Scanner console = new Scanner(System.in);
  12.    
  13.         double budget = Double.parseDouble(console.nextLine());
  14.         String season = console.nextLine();
  15.    
  16.         boolean isSummer = season.equalsIgnoreCase("summer");
  17.         String destination;
  18.         String restingPlace = isSummer ? "Camp" : "Hotel";
  19.         double cost;
  20.    
  21.         if (budget <= 100) {
  22.             destination = "Bulgaria";
  23.        
  24.             if (isSummer) {
  25.                 cost = 0.30;
  26.             } else {
  27.                 cost = 0.70;
  28.             }
  29.         }
  30.         else if (budget <= 1000) {
  31.             destination = "Balkans";
  32.        
  33.             if (isSummer) {
  34.                 cost = 0.40;
  35.             } else {
  36.                 cost = 0.80;
  37.             }
  38.         }
  39.         else {
  40.             destination = "Europe";
  41.             restingPlace = "Hotel";
  42.             cost = 0.90;
  43.         }
  44.    
  45.         System.out.printf("Somewhere in %s%n%s - %.2f",
  46.                           destination, restingPlace, (budget * cost));
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment