Okada proposes one solution.
On/off control alone can be done easily with simple timer circuits, as can counting but by the time the tasks are combined and presumably some indication of the number of cycles is added, a part hardware and part software solution is easiest. You also have to consider factors like switch debouncing, although pressing a switch once may be one physical operation, in an electrical sense, the switch contacts never simply close and open, the elasticity of the switch materials and the brief "partially connected" point where the contacts make and break usually produces many pulses which you obviously want to ignore. Also consider you probably want a display to show how many times you set the spray to operate and maybe how many of those remain to be executed. The display could be LED, LCD or even OLED but each has a different way of being driven.
So please give more information:
1. the pump ratings so we can advise on how to control it's power feed.
2. does it need a display and if so, what type do you want. (LCD = easiest but physically bigger, low power consumption / LED = smaller but uses more power and support circuits)
3. are you able to program a simple microcontroller? (not difficult but steep learning curve!)
Brian.