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, seniorPrice float64
- 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
- }
- 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