Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class WorldSnooker {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String championship = scanner.nextLine();
- String ticketType = scanner.nextLine();
- int ticketCount = Integer.parseInt(scanner.nextLine());
- String picture = scanner.nextLine();
- double ticketPrice = 0;
- switch (championship) {
- case "Quarter final":
- switch (ticketType) {
- case "Standard":
- ticketPrice = 55.5;
- break;
- case "Premium":
- ticketPrice = 105.2;
- break;
- case "VIP":
- ticketPrice = 118.9;
- break;
- }
- break;
- case "Semi final":
- switch (ticketType) {
- case "Standard":
- ticketPrice = 75.88;
- break;
- case "Premium":
- ticketPrice = 125.22;
- break;
- case "VIP":
- ticketPrice = 300.40;
- break;
- }
- break;
- case "Final":
- switch (ticketType) {
- case "Standard":
- ticketPrice = 110.10;
- break;
- case "Premium":
- ticketPrice = 160.66;
- break;
- case "VIP":
- ticketPrice = 400;
- break;
- }
- break;
- }
- double totalPrice = ticketPrice * ticketCount;
- if (totalPrice > 4000) {
- totalPrice *= 0.75;
- } else if (totalPrice > 2500) {
- totalPrice *= 0.9;
- if (picture.equals("Y")) {
- double pictureTotalPrice = ticketCount * 40;
- totalPrice += pictureTotalPrice;
- }
- } else {
- if (picture.equals("Y")) {
- double pictureTotalPrice = ticketCount * 40;
- totalPrice += pictureTotalPrice;
- }
- }
- System.out.printf("%.2f", totalPrice);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement