It is usually best to train your pets when they are young, but pets can pick up bad habits as they age. If you missed out on properly training your cat when it was a kitten or you have adopted an older cat it is not to late to "teach an old dog (or cat) new tricks". It will take a little bit longer, but it can be done. Don't give up on your cat just because it is a little long in the tooth, there are some things you can do to correct behavior problems.
Before beginning your training in earnest it is a good idea to take your cat to the veterinarian to rule out any physical, mental or medical issues as reasons for errant behavior. Once your cat has been cleared medically, it is time to start training your older pet!
Punishing your cat for bad behavior will not work. The only thing that your cat will learn is to dislike you and it may make her behavior worse. Even though your cat may poop on the carpet or scratch up your furniture, yelling at her will not make her stop.
Instead of punishment, try positive reinforcement. Give your cat a treat when they do something good. If they go in their litter box (instead of on the floor) give them some catnip. Cats are like people in the fact that if an experience is positive they will try it again. If it is a negative experience they will likely try and avoid it next time. They can be stubborn though and may repeat the negative experience, so be patient and continue to be positive with them until they change their behavior.
Make it easy for your cat to succeed. If your cat is overweight he may need steps to get on or off of the bed or couch. If your cat's litter box has a hood or cover on it, they may not be able to fit. This may be the reason why they are going on the floor. Remove the cover and place the cat inside to remind them of what they should be doing. You should also clean it out. Maybe, it is so full that they don't want to go in there anymore! Be sure to give praise and treats when they go inside the litter box. This will encourage her to repeat it.