Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MetricConvert {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String championship = scan.nextLine();
- String ticketType = scan.nextLine();
- int ticketCount = Integer.parseInt(scan.nextLine());
- String picture = scan.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.4;
- break;
- }
- break;
- case "Final":
- switch (ticketType) {
- case "Standard":
- ticketPrice = 110.1;
- break;
- case "Premium":
- ticketPrice = 160.66;
- break;
- case "VIP":
- ticketPrice = 400;
- break;
- }
- break;
- }
- double totalPrice = ticketPrice * ticketCount;
- //System.out.println(totalPrice);
- if (totalPrice > 4000) {
- totalPrice *= 0.75;
- } else if (totalPrice > 2500) {
- totalPrice *= 0.9;
- }
- if (picture.equals("Y") && totalPrice <= 4000) {
- double pictureTotalPrice = ticketCount * 40;
- totalPrice += pictureTotalPrice;
- }
- System.out.printf("%.2f", totalPrice);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement