Punishing a cat for peeing on the carpet is a no-no. Cats do not pee outside of their litter boxes without a reason, and punishing them for doing so is confusing and harmful to the cat. The cat caretaker has to take steps to discover why the cat is peeing on the carpet, rug, or furniture in the first place, and then take action to mitigate the offending situations (for the cat, that is).
How to Punish a Cat for Peeing On Carpet
A cat that urinates outside of the litter box could have a physical disease. Cats develop urinary tract diseases occasionally, and they can be quickly fatal. Take your cat to the vet for a check up to make sure that the inappropriate urinating isn't health-related.
Some cats insist on having a squeaky clean litter box. You should make sure you take the dirty litter out each day. Start with a clean litter box and fresh litter as you put steps in place to curb the inappropriate behavior.
When you find the places where the cat has been urinating, use an enzyme spray to get rid of the smell. You can get these enzymes at pet stores or grocery stores. If the urine is on the carpeting, you may have to use the enzyme treatment several times to completely get rid of the odor.
Cover the area with aluminum foil and put a little vinegar in a small bowl on it. As creatures of habit, cats are prone to coming back to a place time after time, and they do not like the feel or sound of foil, and they hate the smell of vinegar.
If the clean litter is not enough to encourage your cat to use it, try switching types. Some cats have really sensitive feet and they may not like the disposable clay litter. Most cats like clumping litter because it is softer than other types.