Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TravelAgency {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String town = scanner.nextLine();
- String packetType = scanner.nextLine();
- String VIP = scanner.nextLine();
- int days = Integer.parseInt(scanner.nextLine());
- double price = 0.0;
- if (town.equals("Bansko") || town.equals("Borovets")) {
- switch (packetType) {
- case "withEquipment":
- if (VIP.equals("yes")) {
- price = 100 * 0.9;
- } else {
- price = 100;
- }
- break;
- case "noEquipment":
- if (VIP.equals("yes")) {
- price = 80 * 0.95;
- } else {
- price = 80;
- }
- break;
- }
- } else if (town.equals("Varna") || town.equals("Burgas")) {
- switch (packetType) {
- case "withBreakfast":
- if (VIP.equals("yes")) {
- price = 130 * 0.88;
- } else {
- price = 130;
- }
- break;
- case "noBreakfast":
- if (VIP.equals("yes")) {
- price = 100 * 0.93;
- } else {
- price = 100;
- }
- break;
- }
- } else {
- System.out.println("Invalid input!");
- }
- if (days <= 0) {
- System.out.println("Days must be positive number!");
- } else if (days > 7) {
- System.out.printf("The price is %.2f lv! Have a nice time!", (price * (days - 1)));
- } else {
- System.out.printf("The price is %.2f lv! Have a nice time!", price * days);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement