SHARE
TWEET

Vacationfund

ValentinM May 19th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Vacationfund {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double numberOfPeople = Double.parseDouble(scanner.nextLine());
  8.         String typeOfPeople = scanner.nextLine();
  9.         String day = scanner.nextLine();
  10.         double sum = 0;
  11.         if (day.equals("Friday")) {
  12.  
  13.             if (typeOfPeople.equals("Students")) {
  14.                 sum = numberOfPeople * 8.45;
  15.                 if (numberOfPeople >= 30) {
  16.                     sum = sum - ( sum * 0.15 );
  17.                 }
  18.             } else if (typeOfPeople.equals("Business")) {
  19.                 if (numberOfPeople >= 100) {
  20.                     numberOfPeople -= 10;
  21.                 }
  22.                 sum = numberOfPeople * 10.90;
  23.             } else if (typeOfPeople.equals("Regular")) {
  24.                 sum = numberOfPeople * 15;
  25.                 if (numberOfPeople >= 10 && numberOfPeople <= 20) {
  26.                     sum = sum - ( sum * 0.05 );
  27.                 }
  28.             }
  29.         } else if (day.equals("Saturday")) {
  30.  
  31.             if (typeOfPeople.equals("Students")) {
  32.                 sum = numberOfPeople * 9.80;
  33.                 if (numberOfPeople >= 30) {
  34.                     sum = sum - ( sum * 0.15 );
  35.                 }
  36.             } else if (typeOfPeople.equals("Business")) {
  37.                 if (numberOfPeople >= 100) {
  38.                     numberOfPeople -= 10;
  39.                 }
  40.                 sum = numberOfPeople * 15.60;
  41.             } else if (typeOfPeople.equals("Regular")) {
  42.                 sum = numberOfPeople * 20;
  43.                 if (numberOfPeople >= 10 && numberOfPeople <= 20) {
  44.                     sum = sum - ( sum * 0.05 );
  45.                 }
  46.             }
  47.         } else if (day.equals("Sunday")) {
  48.  
  49.             if (typeOfPeople.equals("Students")) {
  50.                 sum = numberOfPeople * 10.46;
  51.                 if (numberOfPeople >= 30) {
  52.                     sum = sum - ( sum * 0.15 );
  53.                 }
  54.             } else if (typeOfPeople.equals("Business")) {
  55.                 if (numberOfPeople >= 100) {
  56.                     numberOfPeople -= 10;
  57.                 }
  58.                 sum = numberOfPeople * 16;
  59.             } else if (typeOfPeople.equals("Regular")) {
  60.                 sum = numberOfPeople * 22.50;
  61.                 if (numberOfPeople >= 10 && numberOfPeople <= 20) {
  62.                     sum = sum - ( sum * 0.05 );
  63.                 }
  64.             }
  65.         }
  66.         System.out.printf("Total price: %.2f", sum);
  67.     }
  68.  
  69. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top