Advertisement
Spocoman

06. Truck Driver

Sep 19th, 2024
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.83 KB | None | 0 0
  1. package main
  2. import "fmt"
  3.  
  4. func main() {
  5.     var season string
  6.     fmt.Scanln(&season)
  7.    
  8.     var km float64
  9.     fmt.Scanln(&km)
  10.    
  11.     var kmPrice = 0.0
  12.  
  13.     if (km > 0 && km <= 5000) {
  14.         switch (season) {
  15.             case "Spring", "Autumn":
  16.                 kmPrice = 0.75
  17.             case "Summer":
  18.                 kmPrice = 0.90
  19.             case "Winter":
  20.                 kmPrice = 1.05
  21.         }
  22.     } else if (km > 5000 && km <= 10000) {
  23.         switch (season) {
  24.             case "Spring", "Autumn":
  25.                 kmPrice = 0.95
  26.             case "Summer":
  27.                 kmPrice = 1.10
  28.             case "Winter":
  29.                 kmPrice = 1.25
  30.         }
  31.     } else if (km > 10000 && km <= 20000) {
  32.             kmPrice = 1.45
  33.     }
  34.  
  35.     fmt.Printf("%.2f\n", kmPrice * km * 4 * 0.90)
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement