Advertisement
Spocoman

Pastry Shop

Oct 12th, 2024
155
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.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var typee string
  7.     fmt.Scanln(&typee)
  8.    
  9.     var quantity, date int
  10.     fmt.Scanln(&quantity)
  11.     fmt.Scanln(&date)
  12.    
  13.     price := 0.0
  14.    
  15.     if date <= 15 {
  16.         if typee == "Cake" {
  17.             price = 24.00
  18.         } else if typee == "Souffle" {
  19.             price = 6.66
  20.         } else {
  21.             price = 12.60
  22.         }
  23.     } else {
  24.         if typee == "Cake" {
  25.             price = 28.70
  26.         } else if typee == "Souffle" {
  27.             price = 9.80
  28.         } else {
  29.             price = 16.98
  30.         }
  31.     }
  32.  
  33.     sum := price * float64(quantity)
  34.  
  35.     if date <= 22 {
  36.         if sum >= 100 && sum <= 200 {
  37.             sum -= sum * 0.15
  38.         } else if sum > 200 {
  39.             sum -= sum * 0.25
  40.         }
  41.     }
  42.  
  43.     if date <= 15 {
  44.         sum -= sum * 0.10
  45.     }
  46.  
  47.     fmt.Printf("%.2f\n", sum)
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement