SHARE
TWEET

Vacation

MladenPetrov Sep 20th, 2019 (edited) 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Vacation {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int count = scanner.nextInt();
  8.         String people = scanner.next();
  9.         String day = scanner.next();
  10.         double price = 0;
  11.  
  12.         if (people.equals("Students")) {
  13.             if (day.equals("Friday")) {
  14.                 price = 8.45;
  15.             } else if (day.equals("Saturday")) {
  16.                 price = 9.80;
  17.             } else if (day.equals("Sunday")) {
  18.                 ;
  19.                 price = 10.46;
  20.             }
  21.         }
  22.  
  23.         if (people.equals("Business")) {
  24.             if (day.equals("Friday")) {
  25.                 price = 10.90;
  26.             } else if (day.equals("Saturday")) {
  27.                 price = 15.60;
  28.             } else if (day.equals("Sunday")) {
  29.                 ;
  30.                 price = 16;
  31.             }
  32.         }
  33.  
  34.         if (people.equals("Regular")) {
  35.             if (day.equals("Friday")) {
  36.                 price = 15;
  37.             } else if (day.equals("Saturday")) {
  38.                 price = 20;
  39.             } else if (day.equals("Sunday")) {
  40.                 price = 22.50;
  41.             }
  42.         }
  43.  
  44.         double totalPrice = price * count;
  45.  
  46.         if (people.equals("Students") && count >= 30) {
  47.             totalPrice = totalPrice * 0.85;
  48.         } else if (people.equals("Business") && count >= 100) {
  49.             totalPrice = totalPrice - (10 * price);
  50.         } else if (people.equals("Regular") && (count >= 10 && count <= 20)) {
  51.             totalPrice = totalPrice * 0.95;
  52.         }
  53.         System.out.printf("Total price: %.2f", totalPrice);
  54.     }
  55. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top