Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var country, souvenir, print string
- fmt.Scanln(&country)
- fmt.Scanln(&souvenir)
- var quantity int
- fmt.Scanln(&quantity)
- price := 0.0
- switch country {
- case "Argentina": {
- switch souvenir {
- case "flags":
- price = 3.25
- case "caps":
- price = 7.20
- case "posters":
- price = 5.10
- case "stickers":
- price = 1.25
- default:
- print = "Invalid stock!"
- }
- }
- case "Brazil": {
- switch souvenir {
- case "flags":
- price = 4.20
- case "caps":
- price = 8.50
- case "posters":
- price = 5.35
- case "stickers":
- price = 1.20
- default:
- print = "Invalid stock!"
- }
- }
- case "Croatia": {
- switch souvenir {
- case "flags":
- price = 2.75
- case "caps":
- price = 6.90
- case "posters":
- price = 4.95
- case "stickers":
- price = 1.10
- default:
- print = "Invalid stock!"
- }
- }
- case "Denmark": {
- switch souvenir {
- case "flags":
- price = 3.10
- case "caps":
- price = 6.50
- case "posters":
- price = 4.80
- case "stickers":
- price = 0.90
- default:
- print = "Invalid stock!"
- }
- }
- default:
- print = "Invalid country!"
- }
- if price > 0 {
- fmt.Printf("Pepi bought %d %s of %s for %.2f lv.\n", quantity, souvenir, country, price * float64(quantity))
- } else {
- fmt.Println(print)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement