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