Advertisement
Guest User

Vacantion

a guest
May 23rd, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.75 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner sc = new Scanner(System.in);
  9.  
  10.        int people = Integer.parseInt(sc.nextLine());
  11.        String typeOfTicket = sc.nextLine();
  12.        String day = sc.nextLine();
  13.  
  14.         double price = 0;
  15.  
  16.        switch (typeOfTicket){
  17.            case "Students" : {
  18.                if (day.equals("Friday")){
  19.                    price = people * 8.45;
  20.                }else if (day.equals("Saturday")){
  21.                    price =people * 9.80;
  22.                }else if (day.equals("Sunday")){
  23.                    price = people * 10.46;
  24.                }
  25.                if (people >= 30){
  26.                    price -= price * 0.15;
  27.                }
  28.            }break;
  29.            case  "Business" : {
  30.                if (day.equals("Friday")){
  31.                    price = people * 10.90;
  32.                }else if (day.equals("Saturday")){
  33.                    price =people * 15.60;
  34.                }else if (day.equals("Sunday")){
  35.                    price = people * 16;
  36.                }
  37.                if (people >= 100){
  38.                    price = (people - 10) * price;
  39.                }
  40.            }break;
  41.            case  "Regular" : {
  42.                if (day.equals("Friday")){
  43.                    price = people * 15;
  44.                }else if (day.equals("Saturday")){
  45.                    price =people * 20;
  46.                }else if (day.equals("Sunday")){
  47.                    price = people * 22.50;
  48.                }
  49.                if (people >= 10 && people <= 20){
  50.                    price -= price * 0.05;
  51.                }
  52.            }break;
  53.  
  54.        } System.out.printf("Total price: %.2f",price);
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement