Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double budget = Double.parseDouble(scanner.nextLine());
- String season = scanner.nextLine();
- double moneySpent = 0.0;
- String destination = "";
- String holiday = "";
- switch (season) {
- case "summer":
- if(budget <= 100) {
- moneySpent = 0.3;
- destination = "Bulgaria";
- holiday = "Camp";
- }else if(budget <= 1000) {
- moneySpent = 0.4;
- destination = "Balkans";
- holiday = "Camp";
- }else if(budget > 1000) {
- moneySpent = 0.9;
- destination = "Europe";
- holiday = "Hotel";
- }
- break;
- case "winter":
- holiday = "Hotel";
- if(budget <= 100) {
- moneySpent = 0.7;
- destination = "Bulgaria";
- }else if(budget <= 1000) {
- moneySpent = 0.8;
- destination = "Balkans";
- }else if(budget > 1000) {
- moneySpent = 0.9;
- destination = "Europe";
- }
- break;
- }
- if(season.equals("summer") || season.equals("winter") && budget != 0) {
- System.out.println("Somewhere in " + destination);
- System.out.println(holiday + " - " + String.format("%.2f",budget * moneySpent));
- }
- scanner.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement