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