Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var fruit, fruitSize string
- fmt.Scanln(&fruit)
- fmt.Scanln(&fruitSize)
- var fruitCount int
- fmt.Scanln(&fruitCount)
- fruitPrice := 0.0
- if fruit == "Watermelon" {
- if fruitSize == "small" {
- fruitPrice = 56.00
- } else {
- fruitPrice = 28.70
- }
- } else if fruit == "Mango" {
- if fruitSize == "small" {
- fruitPrice = 36.66
- } else {
- fruitPrice = 19.60
- }
- } else if fruit == "Pineapple" {
- if fruitSize == "small" {
- fruitPrice = 42.10
- } else {
- fruitPrice = 24.80
- }
- } else if fruit == "Raspberry" {
- if fruitSize == "small" {
- fruitPrice = 20.00
- } else {
- fruitPrice = 15.20
- }
- }
- if fruitSize == "small" {
- fruitPrice *= 2
- } else {
- fruitPrice *= 5
- }
- totalPrice := fruitPrice * float64(fruitCount)
- if totalPrice >= 400 && totalPrice <= 1000 {
- totalPrice *= 0.85
- } else if totalPrice > 1000 {
- totalPrice /= 2;
- }
- fmt.Printf("%.2f lv.\n", totalPrice)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement