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 daysInBansko = Integer.parseInt(scan.nextLine());
- String roomType = scan.nextLine();
- String mark = scan.nextLine();
- int nights = daysInBansko - 1;
- double priceOfVacation = 0;
- switch (roomType) {
- case "room for one person":
- priceOfVacation = nights * 18;
- break;
- case "apartment":
- priceOfVacation = nights * 25;
- if (nights < 10) {
- priceOfVacation = priceOfVacation * 0.7;
- } else if (nights >= 10 && nights <= 15) {
- priceOfVacation = priceOfVacation * 0.65;
- } else if (nights > 15) {
- priceOfVacation = priceOfVacation * 0.5;
- }
- break;
- case "president apartment":
- priceOfVacation = nights * 35;
- if (nights < 10) {
- priceOfVacation = priceOfVacation * 0.9;
- } else if (nights > 10 && nights <= 15) {
- priceOfVacation = priceOfVacation * 0.85;
- } else if (nights > 15) {
- priceOfVacation = priceOfVacation * 0.80;
- break;
- }
- if (mark.equals("positive")) {
- priceOfVacation = priceOfVacation + 0.25 * priceOfVacation;
- } else {
- priceOfVacation = priceOfVacation * 0.9;
- }
- System.out.printf("%.2f", priceOfVacation);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement