Advertisement
mark79

Journey

Sep 30th, 2019
678
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 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.         double budget = Double.parseDouble(scanner.nextLine());
  8.         String season = scanner.nextLine();
  9.  
  10.         String destination = "Europe";
  11.         String accommodation = season.equals("summer") ? "Camp" : "Hotel";
  12.         if (budget <= 100) {
  13.             destination = "Bulgaria";
  14.             budget *= season.equals("summer") ? 0.30 : 0.70;
  15.         } else if (budget <= 1000) {
  16.             destination = "Balkans";
  17.             budget *= season.equals("summer") ? 0.40 : 0.80;
  18.         } else {
  19.             budget *= 0.90;
  20.             accommodation = "Hotel";
  21.         }
  22.  
  23.         System.out.printf("Somewhere in %s%n%s - %.2f", destination, accommodation, budget);
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement