Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package first;
- import java.util.Scanner;
- public class vacation {
- public static void main(String[] args) {
- Scanner elly = new Scanner(System.in);
- int groupOfPeople = Integer.parseInt(elly.nextLine());
- String typeGroup = elly.nextLine();
- String dayOfWeek = elly.nextLine();
- double totalPrice = 0;
- double price = 0;
- if (dayOfWeek.equalsIgnoreCase("friday")) {
- if (typeGroup.equalsIgnoreCase("students")) {
- if (groupOfPeople >= 30) {
- price = 8.45 * 0.85;
- totalPrice = groupOfPeople * price;
- } else {
- totalPrice = groupOfPeople * 8.45;
- }
- System.out.printf("Total price: %.2f", totalPrice);
- } else if (typeGroup.equalsIgnoreCase("business")) {
- if (groupOfPeople >= 100) {
- price = 10.90;
- totalPrice = groupOfPeople * price - (10 * price);
- } else {
- totalPrice = groupOfPeople * 10.90;
- }
- System.out.printf("Total price: %.2f", totalPrice);
- } else if (typeGroup.equalsIgnoreCase("regular")) {
- if (groupOfPeople >= 10 && groupOfPeople <= 20) {
- price = 15 * 0.95;
- totalPrice = groupOfPeople * price;
- } else {
- totalPrice = groupOfPeople * 15;
- }
- System.out.printf("Total price: %.2f", totalPrice);
- }
- } if (dayOfWeek.equalsIgnoreCase("saturday")) {
- if (typeGroup.equalsIgnoreCase("students")) {
- if (groupOfPeople >= 30) {
- price = 9.80 * 0.85;
- totalPrice = groupOfPeople * price;
- } else {
- totalPrice = groupOfPeople * 9.80;
- }
- System.out.printf("Total price: %.2f", totalPrice);
- } else if (typeGroup.equalsIgnoreCase("business")) {
- if (groupOfPeople >= 100) {
- price = 15.60;
- totalPrice = groupOfPeople * price - (10 * price);
- } else {
- totalPrice = groupOfPeople * 15.60;
- }
- System.out.printf("Total price: %.2f", totalPrice);
- } else if (typeGroup.equalsIgnoreCase("regular")) {
- if (groupOfPeople >= 10 && groupOfPeople <= 20) {
- price = 20 * 0.95;
- totalPrice = groupOfPeople * price;
- } else {
- totalPrice = groupOfPeople * 20;
- }
- System.out.printf("Total price: %.2f", totalPrice);
- }
- }if (dayOfWeek.equalsIgnoreCase("sunday")) {
- if (typeGroup.equalsIgnoreCase("students")) {
- if (groupOfPeople >= 30) {
- price = 10.46 * 0.85;
- totalPrice = groupOfPeople * price;
- } else {
- totalPrice = groupOfPeople * 10.46;
- }
- System.out.printf("Total price: %.2f", totalPrice);
- } else if (typeGroup.equalsIgnoreCase("business")) {
- if (groupOfPeople >= 100) {
- price = 16;
- totalPrice = groupOfPeople * price - (10 * price);
- } else {
- totalPrice = groupOfPeople * 16;
- }
- System.out.printf("Total price: %.2f", totalPrice);
- } else if (typeGroup.equalsIgnoreCase("regular")) {
- if (groupOfPeople >= 10 && groupOfPeople <= 20) {
- price = 22.50 * 0.95;
- totalPrice = groupOfPeople * price;
- } else {
- totalPrice = groupOfPeople * 22.50;
- }
- System.out.printf("Total price: %.2f", totalPrice);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement