Advertisement
Spocoman

07. School Camp

Sep 19th, 2024
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.54 KB | None | 0 0
  1. package main
  2. import "fmt"
  3.  
  4. func main() {
  5.     var season, group string
  6.     fmt.Scanln(&season)
  7.     fmt.Scanln(&group)
  8.    
  9.     var people, nights int
  10.     fmt.Scanln(&people)
  11.     fmt.Scanln(&nights)
  12.  
  13.     var price = 0.0
  14.     var sport = ""
  15.  
  16.     if (season == "Winter") {
  17.         switch (group) {
  18.             case "boys":
  19.                 price = 9.60
  20.                 sport = "Judo"
  21.             case "girls":
  22.                 price = 9.60
  23.                 sport = "Gymnastics"
  24.             case "mixed":
  25.                 price = 10.00
  26.                 sport = "Ski"
  27.         }
  28.     } else if (season == "Spring") {
  29.         switch (group) {
  30.             case "boys":
  31.                 price = 7.20
  32.                 sport = "Tennis"
  33.             case "girls":
  34.                 price = 7.20
  35.                 sport = "Athletics"
  36.             case "mixed":
  37.                 price = 9.50
  38.                 sport = "Cycling"
  39.         }
  40.     } else {
  41.         switch (group) {
  42.             case "boys":
  43.                 price = 15.00
  44.                 sport = "Football"
  45.             case "girls":
  46.                 price = 15.00
  47.                 sport = "Volleyball"
  48.             case "mixed":
  49.                 price = 20.00
  50.                 sport = "Swimming"
  51.         }
  52.     }
  53.  
  54.     if (people >= 50) {
  55.         price *= 0.50
  56.     } else if (people >= 20) {
  57.         price *= 0.85
  58.     }  else if (people >= 10) {
  59.         price *= 0.95
  60.     }
  61.  
  62.     var totalSum = price * float64(people) * float64(nights)
  63.     fmt.Printf(" %s %.2f lv.\n", sport, totalSum)
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement