Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Vacation {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int people = Integer.parseInt(scan.nextLine());
- String type = scan.nextLine();
- String day = scan.nextLine();
- double price = 0;
- if (day.equals("Friday")) {
- if (type.equals("Students")) {
- price = 8.45;
- } else if (type.equals("Business")) {
- price = 10.90;
- } else if ((type.equals("Regular"))) {
- price = 15;
- }
- } else if (day.equals("Saturday")) {
- if (type.equals("Students")) {
- price = 9.80;
- } else if (type.equals("Business")) {
- price = 15.60;
- } else if ((type.equals("Regular"))) {
- price = 20;
- }
- } else if (day.equals("Sunday")) {
- if (type.equals("Students")) {
- price = 10.46;
- } else if (type.equals("Business")) {
- price = 16;
- } else if ((type.equals("Regular"))) {
- price = 22.50;
- }
- }
- price *= people;
- if (type.equals("Students") && people >= 30) {
- price *= .85;
- } else if (type.equals("Business") && people >= 100) {
- int percentage = (10 / people) * 100;
- price -= price * percentage;
- } else if (type.equals("Regular") && (people >= 10 && people <= 20)) {
- price *= .95;
- }
- System.out.printf("Total price: %.2f%n", price);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement