Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- //• Първи ред – Бюджет, реално число в интервала [10.00...5000.00].
- //• Втори ред – Един от двата възможни сезона: „summer” или “winter”
- System.out.println("Бюджет: ");
- double budget = Double.parseDouble(scanner.nextLine());
- System.out.println("Сезон: ");
- String season = scanner.nextLine();
- String destination;
- String restIn = season.equals("summer") ? "camp" : "hotel";
- double spendBudget;
- if (budget <= 100) {
- spendBudget = budget *= season.equals("winter") ? 0.7 : 0.3;
- destination = "Bulgaria";
- } else if (budget > 100 && budget <= 1000) {
- spendBudget = budget *= season.equals("winter") ? 0.8 : 0.4;
- destination = "Balkans";
- } else {
- spendBudget = budget * 0.9;
- destination = "Europe";
- }
- System.out.printf("Somewhere in %s %n", destination);
- System.out.printf("%s - %.2f", restIn, spendBudget);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement