Advertisement
Spocoman

Oscars week in cinema

Oct 11th, 2024
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 2.97 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.   "fmt"
  5.   "bufio"
  6.   "os"
  7.   "strconv"
  8. )
  9.  
  10. func main() {
  11.     scanner := bufio.NewScanner(os.Stdin)
  12.     scanner.Scan()
  13.     movieName := scanner.Text()
  14.    
  15.     scanner.Scan()
  16.     typeOfHall := scanner.Text()
  17.  
  18.     scanner.Scan()
  19.     ticketCount,_ := strconv.Atoi(scanner.Text())
  20.    
  21.     ticketPrice := 0.0
  22.  
  23.     if movieName == "A Star Is Born" {
  24.         if typeOfHall == "normal" {
  25.             ticketPrice = 7.50
  26.         } else if typeOfHall == "luxury" {
  27.             ticketPrice = 10.50
  28.         } else if typeOfHall == "ultra luxury" {
  29.             ticketPrice = 13.50
  30.         }
  31.     } else if movieName == "Bohemian Rhapsody" {
  32.         if typeOfHall == "normal" {
  33.             ticketPrice = 7.35
  34.         } else if typeOfHall == "luxury" {
  35.             ticketPrice = 9.45
  36.         } else if typeOfHall == "ultra luxury" {
  37.             ticketPrice = 12.75
  38.         }
  39.     } else if movieName == "Green Book" {
  40.         if typeOfHall == "normal" {
  41.             ticketPrice = 8.15
  42.         } else if typeOfHall == "luxury" {
  43.             ticketPrice = 10.25
  44.         } else if typeOfHall == "ultra luxury" {
  45.             ticketPrice = 13.25
  46.         }
  47.     } else if movieName == "The Favourite" {
  48.         if typeOfHall == "normal" {
  49.             ticketPrice = 8.75
  50.         } else if typeOfHall == "luxury" {
  51.             ticketPrice = 11.55
  52.         } else if typeOfHall == "ultra luxury" {
  53.             ticketPrice = 13.95
  54.         }
  55.     }
  56.  
  57.     fmt.Printf("%s -> %.2f lv.\n", movieName, ticketPrice * float64(ticketCount))
  58. }
  59.  
  60. ИЛИ:
  61.  
  62. package main
  63.  
  64. import (
  65.   "fmt"
  66.   "bufio"
  67.   "os"
  68.   "strconv"
  69. )
  70.  
  71. func main() {
  72.     scanner := bufio.NewScanner(os.Stdin)
  73.     scanner.Scan()
  74.     movieName := scanner.Text()
  75.    
  76.     scanner.Scan()
  77.     typeOfHall := scanner.Text()
  78.  
  79.     scanner.Scan()
  80.     ticketCount,_ := strconv.Atoi(scanner.Text())
  81.    
  82.     ticketPrice := 0.0
  83.    
  84.     switch movieName {
  85.     case "A Star Is Born":
  86.         switch typeOfHall {
  87.         case "normal":
  88.             ticketPrice = 7.50
  89.         case "luxury":
  90.             ticketPrice = 10.50
  91.         case "ultra luxury":
  92.             ticketPrice = 13.50
  93.         }
  94.     case "Bohemian Rhapsody":
  95.         switch typeOfHall {
  96.         case "normal":
  97.             ticketPrice = 7.35
  98.         case "luxury":
  99.             ticketPrice = 9.45
  100.         case "ultra luxury":
  101.             ticketPrice = 12.75
  102.         }
  103.     case "Green Book":
  104.         switch typeOfHall {
  105.         case "normal":
  106.             ticketPrice = 8.15
  107.         case "luxury":
  108.             ticketPrice = 10.25
  109.         case "ultra luxury":
  110.             ticketPrice = 13.25
  111.         }
  112.     case  "The Favourite":
  113.         switch typeOfHall {
  114.         case "normal":
  115.             ticketPrice = 8.75
  116.         case "luxury":
  117.             ticketPrice = 11.55
  118.         case "ultra luxury":
  119.             ticketPrice = 13.95
  120.         }
  121.     }
  122.  
  123.     fmt.Printf("%s -> %.2f lv.\n", movieName, ticketPrice * float64(ticketCount))
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement