Only A WOMAN could suggest castration as the first solution. Disgrace upon you.
Good grief? What backward country do you live in? In the USA and most of the Western countries, it's routine to castrate male dogs and cats and spay female dogs and cats before they have their first heat. If you wait until they're older, they have already established behavior patterns that are difficult to eradicate. A male dog castrated at, say age 3 or 4, will still chase after females in heat. This gives them the extra strength to jump over fences, and the stupidity to run across a busy street.
If you have a population of un-neutered pets, they will copulate at every chance, and soon you will have more of the animals than the country can support. At this point they will either end up in a facility for euthanasia, or they will roam the countryside, killing wildlife and overturning garbage cans. Female dogs and cats usually come into heat twice a year,
but not all at the same time. There will always be one-sixth of the female population in heat, and that pumps more than enough pheromones into the air to drive every male crazy within half a mile.
Who wants to live in a country like that???
If you have an intact female that you don't want to breed, you have to lock her up very sturdily. The males can knock down gates and jump through windows. And even then, what you've got is the males surrounding your house whining and barking and fighting among themselves at all hours of the day and night. And you've got a female who is constantly crying and whining.
This is intolerable!
People only do this in backward countries.
As I've noted earlier in this thread, every country's cat population should be locked indoors, or at least in a secure area from which they cannot escape. Cats who are allowed to roam kill
billions of birds every year, and are a major factor in the near-extinction of some species. A cat that is un-neutered and allowed to run free can produce eight babies every year. This is a huge threat to the bird population, and only irresponsible, uncivilized people do this.
This is especially true in New Zealand, where the birds evolved in an ecosystem with no mammals so many of them are incapable of flight. (Except bats, who also arrived by flying across the sea, and bats do not attack birds.) Cats, rats and stoats (we Americans call them "ermines") were all introduced by British colonists, and they are ravaging the ecosystem.