Advertisement
Spocoman

World Snooker Championship

Oct 14th, 2024
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.68 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "bufio"
  5.     "fmt"
  6.     "os"
  7.     "strconv"
  8. )
  9.  
  10. func main() {
  11.     scanner := bufio.NewScanner(os.Stdin)
  12.     scanner.Scan()
  13.     stageOfTheChampionship := scanner.Text()
  14.    
  15.     scanner.Scan()
  16.     typeOfTickets := scanner.Text()
  17.    
  18.     scanner.Scan()
  19.     ticketCount,_ := strconv.Atoi(scanner.Text())
  20.  
  21.     scanner.Scan()
  22.     selfieWithTheTrophy := scanner.Text()
  23.    
  24.     var ticketPrice, totalPrice float64
  25.  
  26.     if stageOfTheChampionship == "Quarter final" {
  27.         if typeOfTickets == "Standard" {
  28.             ticketPrice = 55.50
  29.         } else if typeOfTickets == "Premium" {
  30.             ticketPrice = 105.20
  31.         } else if typeOfTickets == "VIP" {
  32.             ticketPrice = 118.90
  33.         }
  34.     } else if stageOfTheChampionship == "Semi final" {
  35.         if typeOfTickets == "Standard" {
  36.             ticketPrice = 75.88
  37.         } else if typeOfTickets == "Premium" {
  38.             ticketPrice = 125.22
  39.         } else if typeOfTickets == "VIP" {
  40.             ticketPrice = 300.40
  41.         }
  42.     } else if stageOfTheChampionship == "Final" {
  43.         if typeOfTickets == "Standard" {
  44.             ticketPrice = 110.10
  45.         } else if typeOfTickets == "Premium" {
  46.             ticketPrice = 160.66
  47.         } else if typeOfTickets == "VIP" {
  48.             ticketPrice = 400.00
  49.         }
  50.     }
  51.  
  52.     totalPrice = ticketPrice * float64(ticketCount)
  53.  
  54.     if totalPrice > 4000 {
  55.         totalPrice *= 0.75
  56.         selfieWithTheTrophy = "N"
  57.     } else if totalPrice > 2500 {
  58.         totalPrice *= 0.90
  59.     }
  60.  
  61.     if selfieWithTheTrophy == "Y" {
  62.         totalPrice += float64(ticketCount * 40)
  63.     }
  64.  
  65.     fmt.Printf("%.2f\n", totalPrice)
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement