It's beyond frustrating when you find a puddle of urine in the middle of your bed, or a secret pile of feces behind the washing machine.
Punishing your cat, either verbally or physically, will do absolutely nothing to solve the problem of inappropriate elimination. If you have been scrupulous in keeping the cat box clean, providing multiple boxes for your multi-cat home, and have placed the box properly, another approach might just work to get your kitty using the litter box again rather than the rug or furniture.
Be sure to have your vet check your cat before starting an aversion program to rule out bladder infection, stones, or other health problems.
Getting Your Cat Back on Track
It will probably take a bit of time and effort on your part to get your cat back to using the litter box, but most cats will return to the box if the places they have been soiling inappropriately become undesirable.
An important factor to this aversion training is to remove all traces of urine or feces odor, which will otherwise attract the cat back to the area. Enzyme cleaners work best at removing these smells.