Advertisement
Spocoman

Excursion Calculator

Oct 8th, 2024
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.99 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var personCount int
  7.     fmt.Scanln(&personCount)
  8.    
  9.     var season string
  10.     fmt.Scanln(&season)
  11.    
  12.     personPrice := 0.0
  13.    
  14.     switch season {
  15.     case "spring":
  16.         if personCount <= 5 {
  17.             personPrice = 50.00
  18.         } else {
  19.             personPrice = 48.00
  20.         }
  21.     case "summer":
  22.         if personCount <= 5 {
  23.             personPrice = 48.50
  24.         } else {
  25.             personPrice = 45.00
  26.         }
  27.     case "autumn":
  28.         if personCount <= 5 {
  29.             personPrice = 60.00
  30.         } else {
  31.             personPrice = 49.50
  32.         }
  33.     case "winter":
  34.         if personCount <= 5 {
  35.             personPrice = 86.00
  36.         } else {
  37.             personPrice = 85.00
  38.         }
  39.     }
  40.      
  41.     if season == "summer" {
  42.         personPrice *= 0.85
  43.     } else if season == "winter" {
  44.         personPrice *= 1.08
  45.     }
  46.  
  47.     fmt.Printf("%.2f leva.", personPrice * float64(personCount))
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement