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