Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SkiTrip {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int day = Integer.parseInt(scan.nextLine());
- String room = scan.nextLine();
- String evaluation = scan.nextLine();
- double price = 0;
- double days = day - 1;
- switch (room) {
- case "room for one person":
- price = days * 18;
- break;
- case "apartment":
- price = days * 25;
- if (days < 10) {
- price = price * 0.7;
- } else if (days >= 10 && days <= 15) {
- price = price * 0.65;
- } else if (price > 15) {
- price = price * 0.5;
- }
- break;
- case "president apartment":
- price = days * 35;
- if (days < 10) {
- price = price * 0.9;
- } else if (days >= 10 && days <= 15) {
- price = price * 0.85;
- } else if (price > 15) {
- price = price * 0.8;
- }
- break;
- }
- switch (evaluation) {
- case "positive":
- price = price * 1.25;
- break;
- case "negative":
- price = price * 0.9;
- }
- System.out.printf("%.2f", price);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement