Advertisement
Spocoman

Hair Salon

Oct 10th, 2024
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.97 KB | None | 0 0
  1. package main
  2.  
  3. import "fmt"
  4.  
  5. func main() {
  6.     var target, sum int
  7.     fmt.Scanln(&target)
  8.  
  9.     var service, category string
  10.     fmt.Scanln(&service)
  11.    
  12.     for target > sum && service != "closed" {
  13.         fmt.Scanln(&category)
  14.            
  15.         if service == "haircut" {
  16.             switch category {
  17.             case "mens":
  18.                 sum += 15
  19.             case "ladies":
  20.                 sum += 20
  21.             case "kids":
  22.                 sum += 10
  23.             }
  24.         } else if service == "color" {
  25.             switch category {
  26.             case "touch up":
  27.                 sum += 20
  28.             case "full color":
  29.                 sum += 30
  30.             }
  31.         }
  32.         fmt.Scanln(&service)
  33.     }
  34.  
  35.     if sum >= target {
  36.         fmt.Println("You have reached your target for the day!")
  37.     } else {
  38.         fmt.Printf("Target not reached! You need %dlv. more.\n", target - sum)
  39.     }
  40.     fmt.Printf("Earned money: %dlv.\n", sum)
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement