Advertisement
Spocoman

Football Souvenirs

Oct 9th, 2024
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.74 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var country, souvenir, print string
  7.     fmt.Scanln(&country)
  8.     fmt.Scanln(&souvenir)
  9.  
  10.     var quantity int
  11.     fmt.Scanln(&quantity)
  12.  
  13.     price := 0.0
  14.  
  15.     switch country {
  16.     case "Argentina": {
  17.         switch souvenir {
  18.         case "flags":
  19.             price = 3.25
  20.         case "caps":
  21.             price = 7.20
  22.         case "posters":
  23.             price = 5.10
  24.         case "stickers":
  25.             price = 1.25
  26.         default:
  27.             print = "Invalid stock!"
  28.         }
  29.     }
  30.     case "Brazil": {
  31.         switch souvenir {
  32.         case "flags":
  33.             price = 4.20
  34.         case "caps":
  35.             price = 8.50
  36.         case "posters":
  37.             price = 5.35
  38.         case "stickers":
  39.             price = 1.20
  40.         default:
  41.             print = "Invalid stock!"
  42.         }
  43.     }
  44.     case "Croatia": {
  45.         switch souvenir {
  46.         case "flags":
  47.             price = 2.75
  48.         case "caps":
  49.             price = 6.90
  50.         case "posters":
  51.             price = 4.95
  52.         case "stickers":
  53.             price = 1.10
  54.         default:
  55.             print = "Invalid stock!"
  56.         }
  57.     }
  58.     case "Denmark": {
  59.         switch souvenir {
  60.         case "flags":
  61.             price = 3.10
  62.         case "caps":
  63.             price = 6.50
  64.         case "posters":
  65.             price = 4.80
  66.         case "stickers":
  67.             price = 0.90
  68.         default:
  69.             print = "Invalid stock!"
  70.         }
  71.     }
  72.     default:
  73.         print = "Invalid country!"
  74.     }
  75.  
  76.     if price > 0 {
  77.         fmt.Printf("Pepi bought %d %s of %s for %.2f lv.\n", quantity, souvenir, country, price * float64(quantity))
  78.     } else {
  79.        fmt.Println(print)
  80.     }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement