Advertisement
Spocoman

03. New House

Sep 18th, 2024
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.10 KB | None | 0 0
  1. package main
  2. import "fmt"
  3.  
  4. func main() {
  5.     var flower string
  6.     fmt.Scanln(&flower)
  7.      
  8.     var quantity int
  9.     fmt.Scanln(&quantity)
  10.    
  11.     var budget float64
  12.     fmt.Scanln(&budget)
  13.    
  14.     var sum = float64(quantity)
  15.  
  16.     if (flower == "Roses") {
  17.         sum *= 5.00
  18.         if (quantity > 80) {
  19.             sum *= 0.90
  20.         }
  21.     } else if (flower == "Dahlias") {
  22.         sum *= 3.80
  23.         if (quantity > 90) {
  24.             sum *= 0.85
  25.         }
  26.     } else if (flower == "Tulips") {
  27.         sum *= 2.80
  28.         if (quantity > 80) {
  29.             sum *= 0.85
  30.         }
  31.     } else if (flower == "Narcissus") {
  32.         sum *= 3.00
  33.         if (quantity < 120) {
  34.             sum *= 1.15
  35.         }
  36.     } else if (flower == "Gladiolus") {
  37.         sum *= 2.50
  38.         if (quantity < 80) {
  39.             sum *= 1.20
  40.         }
  41.     }
  42.  
  43.     if (sum > budget) {
  44.         fmt.Printf("Not enough money, you need %.2f leva more.", sum - budget)
  45.     } else {
  46.         fmt.Printf("Hey, you have a great garden with %d %s and %.2f leva left.", quantity, flower, budget - sum)
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement