Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- "bufio"
- "os"
- "strconv"
- )
- func main() {
- scanner := bufio.NewScanner(os.Stdin)
- scanner.Scan()
- movieName := scanner.Text()
- scanner.Scan()
- typeOfHall := scanner.Text()
- scanner.Scan()
- ticketCount,_ := strconv.Atoi(scanner.Text())
- ticketPrice := 0.0
- if movieName == "A Star Is Born" {
- if typeOfHall == "normal" {
- ticketPrice = 7.50
- } else if typeOfHall == "luxury" {
- ticketPrice = 10.50
- } else if typeOfHall == "ultra luxury" {
- ticketPrice = 13.50
- }
- } else if movieName == "Bohemian Rhapsody" {
- if typeOfHall == "normal" {
- ticketPrice = 7.35
- } else if typeOfHall == "luxury" {
- ticketPrice = 9.45
- } else if typeOfHall == "ultra luxury" {
- ticketPrice = 12.75
- }
- } else if movieName == "Green Book" {
- if typeOfHall == "normal" {
- ticketPrice = 8.15
- } else if typeOfHall == "luxury" {
- ticketPrice = 10.25
- } else if typeOfHall == "ultra luxury" {
- ticketPrice = 13.25
- }
- } else if movieName == "The Favourite" {
- if typeOfHall == "normal" {
- ticketPrice = 8.75
- } else if typeOfHall == "luxury" {
- ticketPrice = 11.55
- } else if typeOfHall == "ultra luxury" {
- ticketPrice = 13.95
- }
- }
- fmt.Printf("%s -> %.2f lv.\n", movieName, ticketPrice * float64(ticketCount))
- }
- ИЛИ:
- package main
- import (
- "fmt"
- "bufio"
- "os"
- "strconv"
- )
- func main() {
- scanner := bufio.NewScanner(os.Stdin)
- scanner.Scan()
- movieName := scanner.Text()
- scanner.Scan()
- typeOfHall := scanner.Text()
- scanner.Scan()
- ticketCount,_ := strconv.Atoi(scanner.Text())
- ticketPrice := 0.0
- switch movieName {
- case "A Star Is Born":
- switch typeOfHall {
- case "normal":
- ticketPrice = 7.50
- case "luxury":
- ticketPrice = 10.50
- case "ultra luxury":
- ticketPrice = 13.50
- }
- case "Bohemian Rhapsody":
- switch typeOfHall {
- case "normal":
- ticketPrice = 7.35
- case "luxury":
- ticketPrice = 9.45
- case "ultra luxury":
- ticketPrice = 12.75
- }
- case "Green Book":
- switch typeOfHall {
- case "normal":
- ticketPrice = 8.15
- case "luxury":
- ticketPrice = 10.25
- case "ultra luxury":
- ticketPrice = 13.25
- }
- case "The Favourite":
- switch typeOfHall {
- case "normal":
- ticketPrice = 8.75
- case "luxury":
- ticketPrice = 11.55
- case "ultra luxury":
- ticketPrice = 13.95
- }
- }
- fmt.Printf("%s -> %.2f lv.\n", movieName, ticketPrice * float64(ticketCount))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement