Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var month string
- fmt.Scanln(&month)
- var hours, people int
- fmt.Scanln(&hours)
- fmt.Scanln(&people)
- var time string
- fmt.Scanln(&time)
- price := 0.0
- if month == "march" || month == "april" || month == "may" {
- if time == "day" {
- price = 10.50
- hours = 3
- } else {
- price = 8.40
- }
- } else if month == "june" || month == "july" || month == "august" {
- if time == "day" {
- price = 12.60
- } else {
- price = 10.20
- }
- }
- if people >= 4 {
- price *= 0.9
- }
- if hours >= 5 {
- price /= 2
- }
- total := price * float64(people) * float64(hours)
- fmt.Printf("Price per person for one hour: %.2f\n", price)
- fmt.Printf("Total cost of the visit: %.2f\n", total)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement