Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var juniorCount, seniorCount int
- fmt.Scanln(&juniorCount)
- fmt.Scanln(&seniorCount)
- var trace string
- fmt.Scanln(&trace)
- var juniorPrice = 0.0
- var seniorPrice = 0.0
- switch (trace) {
- case "trail":
- juniorPrice = 5.50
- seniorPrice = 7.00
- case "cross-country":
- juniorPrice = 8.00
- seniorPrice = 9.50
- case "downhill":
- juniorPrice = 12.25
- seniorPrice = 13.75
- case "road":
- juniorPrice = 20.00
- seniorPrice = 21.50
- }
- var sum = juniorPrice * float64(juniorCount) + seniorPrice * float64(seniorCount)
- if (trace == "cross-country" && juniorCount + seniorCount >= 50) {
- sum *= 0.75
- }
- fmt.Printf("%.2f\n", sum * 0.95)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement