Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package BasicSyntax;
- 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 group = scan.nextLine();
- String day = scan.nextLine();
- double price = 0.0;
- if (group.equals("Students")) {
- switch (day) {
- case "Friday":
- price = 8.45;
- break;
- case "Saturday":
- price = 9.80;
- break;
- case "Sunday":
- price = 10.46;
- break;
- }
- if (people >= 30) {
- price *= 0.85;
- }
- } else if (group.equals("Business")) {
- switch (day) {
- case "Friday":
- price = 10.90;
- break;
- case "Saturday":
- price = 15.60;
- break;
- case "Sunday":
- price = 16.00;
- break;
- }
- } else if (group.equals("Regular")) {
- switch (day) {
- case "Friday":
- price = 15.0;
- break;
- case "Saturday":
- price = 20.0;
- break;
- case "Sunday":
- price = 22.50;
- break;
- }
- if (people >= 10 && people <= 20) {
- price *= 0.95;
- }
- }
- if (group.equals("Business") && people >= 100) {
- price *= (people -10);
- System.out.printf("Total price: %.2f", price);
- } else {
- System.out.printf("Total price: %.2f", price * people);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement