Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var cash float64
- fmt.Scanln(&cash)
- var gender string
- fmt.Scanln(&gender)
- var age int
- fmt.Scanln(&age)
- var sport string
- fmt.Scanln(&sport)
- sum := 0.0
- if gender == "m" {
- switch sport {
- case "Gym":
- sum = 42
- case "Boxing":
- sum = 41
- case "Yoga":
- sum = 45
- case "Zumba":
- sum = 34
- case "Dances":
- sum = 51
- case "Pilates":
- sum = 39
- }
- } else {
- switch sport {
- case "Gym":
- sum = 35
- case "Boxing":
- sum = 37
- case "Yoga":
- sum = 42
- case "Zumba":
- sum = 31
- case "Dances":
- sum = 53
- case "Pilates":
- sum = 37
- }
- }
- if age <= 19 {
- sum *= 0.8
- }
- if sum <= cash {
- fmt.Printf("You purchased a 1 month pass for %s.", sport)
- } else {
- fmt.Printf("You don't have enough money! You need $%.2f more.\n", sum - cash)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement