Advertisement
Spocoman

Coffee Machine

Oct 5th, 2024
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.11 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var drink, sugar string
  7.     fmt.Scanln(&drink)
  8.     fmt.Scanln(&sugar)
  9.    
  10.     var drinkCount int
  11.     fmt.Scanln(&drinkCount)
  12.    
  13.     sum := float64(drinkCount)
  14.  
  15.     if drink == "Espresso" {
  16.         if sugar == "Without" {
  17.             sum *= 0.90 * 0.65
  18.         } else if sugar == "Normal" {
  19.             sum *= 1.00
  20.         } else if sugar == "Extra" {
  21.             sum *= 1.20
  22.         }
  23.         if drinkCount > 5 {
  24.             sum *= 0.75
  25.         }
  26.     } else if drink == "Cappuccino" {
  27.         if sugar == "Without" {
  28.             sum *= 0.65
  29.         } else if sugar == "Normal" {
  30.             sum *= 1.20
  31.         } else if sugar == "Extra" {
  32.             sum *= 1.60
  33.         }
  34.     } else if drink == "Tea" {
  35.         if sugar == "Without" {
  36.             sum *= 0.50 * 0.65
  37.         } else if sugar == "Normal" {
  38.             sum *= 0.60
  39.         } else if sugar == "Extra" {
  40.             sum *= 0.70
  41.         }
  42.     }
  43.  
  44.     if sum > 15 {
  45.         sum *= 0.80
  46.     }
  47.  
  48.     fmt.Printf("You bought %d cups of %s for %.2f lv.\n", drinkCount, drink, sum)
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement