Advertisement
desislava_topuzakova

03. Cruise Ship

Jun 6th, 2020
1,150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.94 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class demo {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String kindCruise = scanner.nextLine();
  8.         String room = scanner.nextLine();
  9.         int nights = Integer.parseInt(scanner.nextLine());
  10.         double price = 0.00;
  11.  
  12.         if (kindCruise.equals("Mediterranean")) {
  13.             switch (room) {
  14.                 case "standard cabin":
  15.                     price = nights * 27.50 * 4;
  16.                     break;
  17.                 case "cabin with balcony":
  18.                     price = nights * 30.20 * 4;
  19.                     break;
  20.                 case "apartment":
  21.                     price = nights * 40.50 * 4;
  22.                     break;
  23.             }
  24.         } else if (kindCruise.equals("Adriatic")) {
  25.             switch (room) {
  26.                 case "standard cabin":
  27.                     price = nights * 22.99 * 4;
  28.                     break;
  29.                 case "cabin with balcony":
  30.                     price = nights * 25.00 * 4;
  31.                     break;
  32.                 case "apartment":
  33.                     price = nights * 34.99 * 4;
  34.                     break;
  35.             }
  36.         } else if (kindCruise.equals("Aegean")) {
  37.             switch (room) {
  38.                 case "standard cabin":
  39.                     price = nights * 23.00 * 4;
  40.                     break;
  41.                 case "cabin with balcony":
  42.                     price = nights * 26.60 * 4;
  43.                     break;
  44.                 case "apartment":
  45.                     price = nights * 39.80 * 4;
  46.                     break;
  47.             }
  48.  
  49.         }
  50.         if (nights > 7) {
  51.             price = price - (price * 0.25);
  52.             System.out.printf("Annie's holiday in the %s sea costs %.2f lv.", kindCruise, price);
  53.         } else {
  54.             System.out.printf("Annie's holiday in the %s sea costs %.2f lv.", kindCruise, price);
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement