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 scanner = new Scanner(System.in);
- int people = Integer.parseInt(scanner.nextLine());
- String type = scanner.nextLine();
- String day = scanner.nextLine();
- if (type.equals("Students")) {
- if (day.equals("Friday")) {
- double price = people * 8.45;
- if (people >= 30) {
- double totalPrice = price - (0.15 * price);
- System.out.printf("Total price: %.2f", totalPrice);
- } else {
- System.out.printf("Total price: %.2f", price);
- }
- } else if (day.equals("Saturday")) {
- double price = people * 9.89;
- if (people >= 30) {
- double totalPrice = price - (0.15 * price);
- System.out.printf("Total price: %.2f", totalPrice);
- } else {
- System.out.printf("Total price: %.2f", price);
- }
- } else if (day.equals("Sunday")) {
- double price = people * 10.46;
- if (people >= 30) {
- double totalPrice = price - (0.15 * price);
- System.out.printf("Total price: %.2f", totalPrice);
- } else {
- System.out.printf("Total price: %.2f", price);
- }
- }
- }
- //BUSINES
- else if (type.equals("Business")) {
- if (day.equals("Friday")) {
- double price = people * 10.90;
- if (people >= 100) {
- double totalPrice = price - (10 * 10.90);
- System.out.printf("Total price: %.2f", totalPrice);
- } else {
- System.out.printf("Total price: %.2f", price);
- }
- } else if (day.equals("Saturday")) {
- double price = people * 15.60;
- if (people >= 100) {
- double totalPrice = price - (10 * 15.60);
- System.out.printf("Total price: %.2f", totalPrice);
- } else {
- System.out.printf("Total price: %.2f", price);
- }
- } else if (day.equals("Sunday")) {
- double price = people * 10.46;
- if (people >= 100) {
- double totalPrice = price - (10 * 10.46);
- System.out.printf("Total price: %.2f", totalPrice);
- } else {
- System.out.printf("Total price: %.2f", price);
- }
- }
- }
- //REGULAR
- else if (type.equals("Regular")) {
- if (day.equals("Friday")) {
- double price = people * 15;
- if (people >= 10 && people <= 20) {
- double totalPrice = price - (0.05 * price);
- System.out.printf("Total price: %.2f", totalPrice);
- } else {
- System.out.printf("Total price: %.2f", price);
- }
- } else if (day.equals("Saturday")) {
- double price = people * 20;
- if (people >= 10 && people <= 20) {
- double totalPrice = price - (0.05 * price);
- System.out.printf("Total price: %.2f", totalPrice);
- } else {
- System.out.printf("Total price: %.2f", price);
- }
- } else if (day.equals("Sunday")) {
- double price = people * 22.5;
- if (people >= 10 && people <= 20) {
- double totalPrice = price - (0.05 * price);
- System.out.printf("Total price: %.2f", totalPrice);
- } else {
- System.out.printf("Total price: %.2f", price);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement