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