Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function WorldSnookerChampionship(input) {
- let stageOfTheChampionship = input[0];
- let typesOfTickets = input[1];
- let ticketCount = Number(input[2]);
- let selfieWithTheTrophy = input[3];
- let ticketPrice = 0;
- if (stageOfTheChampionship === "Quarter final") {
- if (typesOfTickets === "Standard") {
- ticketPrice = 55.50;
- } else if (typesOfTickets === "Premium") {
- ticketPrice = 105.20;
- } else if (typesOfTickets === "VIP") {
- ticketPrice = 118.90;
- }
- } else if (stageOfTheChampionship === "Semi final") {
- if (typesOfTickets === "Standard") {
- ticketPrice = 75.88;
- } else if (typesOfTickets === "Premium") {
- ticketPrice = 125.22;
- } else if (typesOfTickets === "VIP") {
- ticketPrice = 300.40;
- }
- } else if (stageOfTheChampionship === "Final") {
- if (typesOfTickets === "Standard") {
- ticketPrice = 110.10;
- } else if (typesOfTickets === "Premium") {
- ticketPrice = 160.66;
- } else if (typesOfTickets === "VIP") {
- ticketPrice = 400;
- }
- }
- let totalPrice = ticketPrice * ticketCount;
- if (totalPrice > 4000) {
- totalPrice *= 0.75;
- selfieWithTheTrophy = "N";
- } else if (totalPrice > 2500) {
- totalPrice *= 0.9;
- }
- if (selfieWithTheTrophy === "Y") {
- totalPrice += ticketCount * 40;
- }
- console.log(`${totalPrice.toFixed(2)}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement