Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var chrysanthemums, roses, tulips int
- fmt.Scanln(&chrysanthemums)
- fmt.Scanln(&roses)
- fmt.Scanln(&tulips)
- var season, holiday string
- fmt.Scanln(&season)
- fmt.Scanln(&holiday)
- var sum = 0.0
- if (season == "Spring" || season == "Summer") {
- sum = 2.00 * float64(chrysanthemums) + 4.10 * float64(roses) + 2.50 * float64(tulips)
- } else if (season == "Autumn" || season == "Winter") {
- sum = 3.75 * float64(chrysanthemums) + 4.5 * float64(roses) + 4.15 * float64(tulips)
- }
- if (holiday == "Y") {
- sum *= 1.15
- }
- if (tulips > 7 && season == "Spring") {
- sum *= 0.95
- }
- if (roses >= 10 && season == "Winter") {
- sum *= 0.90
- }
- if (chrysanthemums + roses + tulips > 20) {
- sum *= 0.80
- }
- fmt.Printf("%.2f\n", sum + 2)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement