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 city = scanner.nextLine();
- String packet = scanner.nextLine();
- String VIP = scanner.nextLine();
- int days = Integer.parseInt(scanner.nextLine());
- double price = 0;
- if ((city.equals("Bansko") || city.equals("Borovets")) && days > 0) {
- if (packet.equals("noEquipment")) {
- price = days * 80;
- if (VIP.equals("yes")) {
- price = price * 0.95;
- }if (days>7){
- price = price - price /days;
- }
- } else if (packet.equals("withEquipment")) {
- price = days * 100;
- if (VIP.equals("yes")) {
- price = price * 0.9;
- }else if (days>7){
- price = price - price/days;
- }
- } else {
- System.out.println("Invalid input!");
- }
- System.out.printf("The price is %.2flv! Have a nice time!", price);
- } else if ((city.equals("Varna") || city.equals("Burgas")) && days > 0) {
- if (packet.equals("withBreakfast")) {
- price = days * 130;
- if (VIP.equals("yes")) {
- price = price * 0.88;
- }else if (days>7){
- price = price - price/days;
- }
- System.out.printf("The price is %.2flv! Have a nice time!", price);
- } else if (packet.equals("noBreakfast")) {
- price = days * 100;
- if (VIP.equals("yes")) {
- price = price * 0.93;
- }else if (days>7){
- price = price - price/days;
- }
- System.out.printf("The price is %.2flv! Have a nice time!", price);
- } else{
- System.out.println("Invalid input!");
- }
- } else if (days <= 0) {
- System.out.println("Days must be positive number!");
- } else{
- System.out.println("Invalid input!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement