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 scanner = new Scanner(System.in);
- int numGroup = Integer.parseInt(scanner.nextLine());
- String typeGroup = scanner.nextLine();
- String typeDay = scanner.nextLine();
- double price = 0;
- if (typeGroup.equals("Students")) {
- if (typeDay.equals("Friday")) {
- price = numGroup * 8.45;
- } else if (typeDay.equals("Saturday")) {
- price = numGroup * 9.80;
- } else if (typeDay.equals("Sunday")) {
- price = numGroup * 10.46;
- }
- if (numGroup >= 30) {
- price *= 0.85;
- }
- } else if (typeGroup.equals("Business")) {
- if (typeDay.equals("Friday")) {
- if (numGroup >= 100) {
- price = (numGroup - 10) * 10.90;
- } else {
- price = numGroup * 10.90;
- }
- } else if (typeDay.equals("Saturday")) {
- if (numGroup >= 100) {
- price = (numGroup - 10) * 15.60;
- } else {
- price = numGroup * 15.60;
- }
- } else if (typeDay.equals("Sunday")) {
- if (numGroup >= 100) {
- price = (numGroup - 10) * 16;
- } else {
- price = numGroup * 16;
- }
- }
- } else if (typeGroup.equals("Regular")) {
- if (typeDay.equals("Friday")) {
- price = numGroup * 15;
- } else if (typeDay.equals("Saturday")) {
- price = numGroup * 20;
- } else if (typeDay.equals("Sunday")) {
- price = numGroup * 22.50;
- }
- if (numGroup >= 10 && numGroup <= 20) {
- price *= 0.95;
- }
- }
- System.out.printf("Total price: %.2f", price);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment