Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class demo {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String kindCruise = scanner.nextLine();
- String room = scanner.nextLine();
- int nights = Integer.parseInt(scanner.nextLine());
- double price = 0.00;
- if (kindCruise.equals("Mediterranean")) {
- switch (room) {
- case "standard cabin":
- price = nights * 27.50 * 4;
- break;
- case "cabin with balcony":
- price = nights * 30.20 * 4;
- break;
- case "apartment":
- price = nights * 40.50 * 4;
- break;
- }
- } else if (kindCruise.equals("Adriatic")) {
- switch (room) {
- case "standard cabin":
- price = nights * 22.99 * 4;
- break;
- case "cabin with balcony":
- price = nights * 25.00 * 4;
- break;
- case "apartment":
- price = nights * 34.99 * 4;
- break;
- }
- } else if (kindCruise.equals("Aegean")) {
- switch (room) {
- case "standard cabin":
- price = nights * 23.00 * 4;
- break;
- case "cabin with balcony":
- price = nights * 26.60 * 4;
- break;
- case "apartment":
- price = nights * 39.80 * 4;
- break;
- }
- }
- if (nights > 7) {
- price = price - (price * 0.25);
- System.out.printf("Annie's holiday in the %s sea costs %.2f lv.", kindCruise, price);
- } else {
- System.out.printf("Annie's holiday in the %s sea costs %.2f lv.", kindCruise, price);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement