Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.11 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int groupNum = Integer.parseInt(scanner.nextLine());
  8.         String typeGroup = scanner.nextLine();
  9.         String day = scanner.nextLine();
  10.         double price = 0.00;
  11.  
  12.         if (typeGroup.equals ("Students"))
  13.         {
  14.             if (day.equals( "Friday"))
  15.             {
  16.                 price = 8.45;
  17.             }
  18.             else if (day.equals( "Saturday"))
  19.             {
  20.                 price = 9.80;
  21.             }
  22.             else if (day.equals( "Sunday"))
  23.             {
  24.                 price = 10.46;
  25.             }
  26.  
  27.         }
  28.         else if (typeGroup.equals( "Business"))
  29.         {
  30.             if (day.equals( "Friday"))
  31.             {
  32.                 price = 10.90;
  33.             }
  34.             else if (day.equals( "Saturday"))
  35.             {
  36.                 price = 15.60;
  37.             }
  38.             else if (day.equals( "Sunday"))
  39.             {
  40.                 price = 16;
  41.             }
  42.  
  43.         }
  44.         else if (typeGroup.equals( "Regular"))
  45.         {
  46.             if (day.equals( "Friday"))
  47.             {
  48.                 price = 15;
  49.             }
  50.             else if (day.equals( "Saturday"))
  51.             {
  52.                 price = 20;
  53.             }
  54.             else if (day.equals( "Sunday"))
  55.             {
  56.                 price = 22.50;
  57.             }
  58.         }
  59.  
  60.         double totalPrice = groupNum * price;
  61.         double discounted = 0;
  62.  
  63.         if (typeGroup.equals( "Regular") && groupNum >= 10 && groupNum <= 20)
  64.         {
  65.             discounted = totalPrice * 0.05;
  66.  
  67.         }
  68.         else if (typeGroup.equals( "Business") && groupNum >= 100)
  69.         {
  70.             discounted = 10 * price;
  71.  
  72.         }
  73.         else if (typeGroup.equals( "Students" )&& groupNum >= 30)
  74.         {
  75.             discounted = totalPrice * 0.15;
  76.  
  77.         }
  78.  
  79.        // Console.WriteLine($"Total price: {totalPrice - discounted:F2}");
  80. double total= totalPrice- discounted;
  81.         System.out.printf("Total price: %.2f",total);
  82.     }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement