Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- var target, sum int
- fmt.Scanln(&target)
- var service, category string
- fmt.Scanln(&service)
- for target > sum && service != "closed" {
- fmt.Scanln(&category)
- if service == "haircut" {
- switch category {
- case "mens":
- sum += 15
- case "ladies":
- sum += 20
- case "kids":
- sum += 10
- }
- } else if service == "color" {
- switch category {
- case "touch up":
- sum += 20
- case "full color":
- sum += 30
- }
- }
- fmt.Scanln(&service)
- }
- if sum >= target {
- fmt.Println("You have reached your target for the day!")
- } else {
- fmt.Printf("Target not reached! You need %dlv. more.\n", target - sum)
- }
- fmt.Printf("Earned money: %dlv.\n", sum)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement