Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Journey {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double budget = Double.parseDouble(scanner.nextLine());
- String season = scanner.nextLine();
- String accommodation = "";
- String destination = "";
- double spend = 0;
- if (budget <= 100) {
- destination = "Bulgaria";
- switch (season) {
- case "summer":
- spend = budget * 0.30;
- accommodation = "Camp";
- break;
- case "winter":
- spend = budget * 0.70;
- accommodation = "Hotel";
- break;
- }
- }
- else if (budget <= 1000) {
- destination = "Balkans";
- switch (season) {
- case "summer":
- spend = budget * 0.40;
- accommodation = "Camp";
- break;
- case "winter":
- spend = budget * 0.80;
- accommodation = "Hotel";
- break;
- }
- }
- else if (budget > 1000) {
- destination = "Europe";
- spend = budget * 0.90;
- accommodation = "Hotel";
- }
- System.out.printf("Somewhere in %s", destination);
- System.out.printf("%n%s - %.2f", accommodation, spend);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement