Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var budget float64
- fmt.Scanln(&budget)
- var season string
- fmt.Scanln(&season)
- var people int
- fmt.Scanln(&people)
- var sum = 0.0
- switch (season) {
- case "Spring":
- sum = 3000
- case "Summer", "Autumn":
- sum = 4200
- case "Winter":
- sum = 2600
- }
- if (people <= 6) {
- sum *= 0.90
- } else if (people <= 11) {
- sum *= 0.85
- } else {
- sum *= 0.75
- }
- if (people % 2 == 0 && season != "Autumn") {
- sum *= 0.95
- }
- if (sum <= budget) {
- fmt.Printf("Yes! You have %.2f leva left.", budget - sum)
- } else {
- fmt.Printf("Not enough money! You need %.2f leva.", sum - budget)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement