Advertisement
Spocoman

Energy Booster

Oct 8th, 2024
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.21 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var fruit, fruitSize string
  7.     fmt.Scanln(&fruit)
  8.     fmt.Scanln(&fruitSize)
  9.  
  10.     var fruitCount int
  11.     fmt.Scanln(&fruitCount)
  12.    
  13.     fruitPrice := 0.0
  14.  
  15.     if fruit == "Watermelon" {
  16.         if fruitSize == "small" {
  17.             fruitPrice = 56.00
  18.         } else {
  19.             fruitPrice = 28.70
  20.         }
  21.     } else if fruit == "Mango" {
  22.         if fruitSize == "small" {
  23.             fruitPrice = 36.66
  24.         } else {
  25.             fruitPrice = 19.60
  26.         }
  27.     } else if fruit == "Pineapple" {
  28.         if fruitSize == "small" {
  29.             fruitPrice = 42.10
  30.         } else {
  31.             fruitPrice = 24.80
  32.         }
  33.     } else if fruit == "Raspberry" {
  34.         if fruitSize == "small" {
  35.             fruitPrice = 20.00
  36.         } else {
  37.             fruitPrice = 15.20
  38.         }
  39.     }
  40.  
  41.     if fruitSize == "small" {
  42.         fruitPrice *= 2
  43.     } else {
  44.         fruitPrice *= 5
  45.     }
  46.  
  47.     totalPrice := fruitPrice * float64(fruitCount)
  48.  
  49.     if totalPrice >= 400 && totalPrice <= 1000 {
  50.         totalPrice *= 0.85
  51.     } else if totalPrice > 1000 {
  52.         totalPrice /= 2;
  53.     }
  54.  
  55.     fmt.Printf("%.2f lv.\n", totalPrice)
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement