One of the toughest things for many peopl to do is get their cat to obey - after all, dogs tend to be extremely compliant as long as you get started training them early on, but cats are a whole different animal (both literally and figuratively!), as they tend to want to do things their own way; while it certainly is true that cats are more difficult to train than dogs, however, it is not true that they are impossible to train, as you simply need to know a few specific things in order to get your cat to obey! Showing your cat who is boss is one of the big things for training a cat, as cats tend to get it in their heads that they are in charge of everything; when a cat is a kitten, their mother will carry them around by the scruff of the neck, and although you may not feel comfortable picking your cat up this way, holding onto the scruff of their neck (even when you are simply petting them every once in a while) can go a long way in letting them know that they are not the one in charge. Just as you would do with a dog (or even with a young child), you will want to make sure the cat realizes they are "in trouble" when they indulge in bad behavior; there are several ways to do this (and it can be different for different cats), but the main thing is for you to find something that your cat dislikes - such as being sprayed with water, or having some sort of noise-maker shaken in front of them - and to do this to your cat when they are doing something they are not supposed to be doing.
And also in the same way you would handle a dog (or even a young child), you will want to reward your cat for good behavior as well; this can be a bit more difficult to do, as it can be tough to find a treat that your cat likes, but once you have found one, use this to reward your cat for good behavior! As you do these things more often, your cat will start doing the things you want them to do more and more often - until this good behavior eventually becomes habit for your cat!