Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var drink, sugar string
- fmt.Scanln(&drink)
- fmt.Scanln(&sugar)
- var drinkCount int
- fmt.Scanln(&drinkCount)
- sum := float64(drinkCount)
- if drink == "Espresso" {
- if sugar == "Without" {
- sum *= 0.90 * 0.65
- } else if sugar == "Normal" {
- sum *= 1.00
- } else if sugar == "Extra" {
- sum *= 1.20
- }
- if drinkCount > 5 {
- sum *= 0.75
- }
- } else if drink == "Cappuccino" {
- if sugar == "Without" {
- sum *= 0.65
- } else if sugar == "Normal" {
- sum *= 1.20
- } else if sugar == "Extra" {
- sum *= 1.60
- }
- } else if drink == "Tea" {
- if sugar == "Without" {
- sum *= 0.50 * 0.65
- } else if sugar == "Normal" {
- sum *= 0.60
- } else if sugar == "Extra" {
- sum *= 0.70
- }
- }
- if sum > 15 {
- sum *= 0.80
- }
- fmt.Printf("You bought %d cups of %s for %.2f lv.\n", drinkCount, drink, sum)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement