Advertisement
Spocoman

03. Flowers

Sep 19th, 2024
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.90 KB | None | 0 0
  1. package main
  2. import "fmt"
  3.  
  4. func main() {
  5.     var chrysanthemums, roses, tulips int
  6.     fmt.Scanln(&chrysanthemums)
  7.     fmt.Scanln(&roses)
  8.     fmt.Scanln(&tulips)
  9.    
  10.     var season, holiday string
  11.     fmt.Scanln(&season)
  12.     fmt.Scanln(&holiday)
  13.    
  14.     var sum = 0.0
  15.  
  16.     if (season == "Spring" || season == "Summer") {
  17.         sum = 2.00 * float64(chrysanthemums) + 4.10 * float64(roses) + 2.50 * float64(tulips)
  18.     } else if (season == "Autumn" || season == "Winter") {
  19.         sum = 3.75 * float64(chrysanthemums) + 4.5 * float64(roses) + 4.15 * float64(tulips)
  20.     }
  21.        
  22.     if (holiday == "Y") {
  23.         sum *= 1.15
  24.     }
  25.     if (tulips > 7 && season == "Spring") {
  26.         sum *= 0.95
  27.     }
  28.     if (roses >= 10 && season == "Winter") {
  29.         sum *= 0.90
  30.     }
  31.     if (chrysanthemums + roses + tulips > 20) {
  32.         sum *= 0.80
  33.     }
  34.  
  35.     fmt.Printf("%.2f\n", sum + 2)
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement