SHARE
TWEET

Cruise ship

Deiancom Sep 18th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package EXAM;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Cruise_Ship_03 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         String cruseType = scanner.nextLine();
  9.         String cabinType = scanner.nextLine();
  10.         int days = Integer.parseInt(scanner.nextLine());
  11.         double price = 0;
  12.  
  13.         if (cruseType.equals("Mediterranean")) {
  14.             if (cabinType.equals("standard cabin")) {
  15.                 price = 27.50 * days * 4;
  16.             } else if (cabinType.equals("cabin with balcony")) {
  17.                 price = 30.20 * days * 4;
  18.             } else {
  19.                 price = 40.50 * days * 4;
  20.             }
  21.         } else if (cruseType.equals("Adriatic")) {
  22.             if (cabinType.equals("standard cabin")) {
  23.                 price = 22.99 * days * 4;
  24.             } else if (cabinType.equals("cabin with balcony")) {
  25.                 price = 25.00 * days * 4;
  26.             } else {
  27.                 price = 34.99 * days * 4;
  28.             }
  29.         } else {
  30.             if (cabinType.equals("standard cabin")) {
  31.                 price = 23.00 * days * 4;
  32.             } else if (cabinType.equals("cabin with balcony")) {
  33.                 price = 26.60 * days * 4;
  34.             } else {
  35.                 price = 39.80 * days * 4;
  36.             }
  37.         }
  38.         if (days > 7) {
  39.             price = price - price * 0.25;
  40.         }
  41.         System.out.printf("Annie's holiday in the %s sea costs %.2f lv.",cruseType,price);
  42.     }
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top