Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int people = Integer.parseInt(sc.nextLine());
- String typeOfTicket = sc.nextLine();
- String day = sc.nextLine();
- double price = 0;
- switch (typeOfTicket){
- case "Students" : {
- if (day.equals("Friday")){
- price = people * 8.45;
- }else if (day.equals("Saturday")){
- price =people * 9.80;
- }else if (day.equals("Sunday")){
- price = people * 10.46;
- }
- if (people >= 30){
- price -= price * 0.15;
- }
- }break;
- case "Business" : {
- if (day.equals("Friday")){
- price = people * 10.90;
- }else if (day.equals("Saturday")){
- price =people * 15.60;
- }else if (day.equals("Sunday")){
- price = people * 16;
- }
- if (people >= 100){
- price = (people - 10) * price;
- }
- }break;
- case "Regular" : {
- if (day.equals("Friday")){
- price = people * 15;
- }else if (day.equals("Saturday")){
- price =people * 20;
- }else if (day.equals("Sunday")){
- price = people * 22.50;
- }
- if (people >= 10 && people <= 20){
- price -= price * 0.05;
- }
- }break;
- } System.out.printf("Total price: %.2f",price);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement