Advertisement
Spocoman

Computer Room

Oct 5th, 2024
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.91 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var month string
  7.     fmt.Scanln(&month)
  8.    
  9.     var hours, people int
  10.     fmt.Scanln(&hours)
  11.     fmt.Scanln(&people)
  12.    
  13.     var time string
  14.     fmt.Scanln(&time)
  15.    
  16.     price := 0.0
  17.  
  18.     if month == "march" || month == "april" || month == "may" {
  19.         if time == "day" {
  20.             price = 10.50
  21.             hours = 3
  22.         } else {
  23.             price = 8.40
  24.         }
  25.     } else if month == "june" || month == "july" || month == "august" {
  26.         if time == "day" {
  27.             price = 12.60
  28.         } else {
  29.             price = 10.20
  30.         }
  31.     }
  32.  
  33.     if people >= 4 {
  34.         price *= 0.9
  35.     }
  36.  
  37.     if hours >= 5 {
  38.         price /= 2
  39.     }
  40.  
  41.     total := price * float64(people) * float64(hours)
  42.  
  43.     fmt.Printf("Price per person for one hour: %.2f\n", price)
  44.     fmt.Printf("Total cost of the visit: %.2f\n", total)
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement