I try to keep the vulgar words to a minimum, as they can mar a book if they're uttered every fifth sentence. My characters usually use: "Shit!" and its variations; "Damn!" and its variations, as well as "Crap!" and its variations but that's the most I use. I don't use the F-bomb or slurs or anything like that.
In YA swears are used sparingly. I mostly agree with Link the Writer. "F~k" is the harshest word I've seen used in English YA fiction - and that was by an antagonist.
I'd probably check out the guidelines for PG-13 or 15 certificate movies - they will give you an idea of what people think is 'acceptable' for teens. Of course there is no certification for novels, so it's really up to the publisher's discretion. I think you'd get away with most things for a 15/16 year old age group, but sexual swear words are still a bit taboo. The f-bomb might be ok in exceptional circumstances, but the c-word is right out, I think!
A good rule about swearing is to save your moments for something really big and important. You can say something like, he swore without actually saying what he said. Or in the City of Bones series she says things like, he told them to do something to themself that was anatomically impossible, (funny and much more classy than swearing).
There isn't a rating system for books. Not here, anyway. I say let your characters say whatever the fu(^ they want. It all depends on the tone of the book. One of my books had a very eloquent narrator, but the dialogue was trash talk (much worse words than the f-bomb). This was the element which grabbed people.
I would normally replace harsh swearing with a form of "softer" swearing. Words like "crap", "damn", or "hell" are generally considered much less offensive than something like the f-word. For example: "What the f***?" would be replaced by "What the hell?" "F*** you!" would be replaced by "Screw you!" "That was s***ty," would be replaced by "That was crap(py)," Similar to AmyHolt above, I might use the stronger variation for something that is big enough to require such words. Cheers.
If it's for YA, I'd keep swearing to a minimum, or leave it out entirely. Even for adults, I'm not fond of swearing too much. It has it's uses, but IMO, overuse has rendered those fewer and fewer.
Use it sparingly and as a dramatic effect. Like when a big, sudden and unexpected event happens which puts your MC into an uncomfortable position.
Just try to keep in mind what you're using it for - is it mrerely to shock people? To capture someone's character? Overuse can make it meaningless, but if your character is the kind of person who swears, then be true to that. Just be aware that a publisher may tell you to take it all out again anyway ;-)
That's the answer right there. If you character is someone who would not use bad language, then don't. If they are, then do, but keep vulgarity in it's place, as emphasis or humour. I love salt, but too much makes a dish unpalateable. And in the specific case of YA fiction, I`d say use it only when truly needed.
Either curse in a believable manner or don't curse at all. For instance, if you don't want to curse, "Hurry up, you idiot" is far better than "If you don't run faster, those darned bad guys are going to get us!" Keep in mind that in writing, a little bit goes a long way. This applies to a lot of things, cursing included. Having a character drop an F-bomb once every 5 pages can easily convey that he's the type to curse every 5 sentences.
In my attempts at YA fiction, my characters do not curse. Period. Most of them are a little too genteel for that. If a curse is implied, the speaker edits it out and if that's confusing here's an excerpt where Thiryn is telling her soldier friends what other soldiers are saying in a different language: “Something about a woman,” she whispered, “and something about - oops -” “‘Oops’?” asked Esgan. “I ain’t never heard that word - ow!” For Targona had jabbed him in the ribs. On the other hand, I don't suggest you follow this example, as it's a bad one. Very forced.
Swearing and curses can carry a lot of awesome weight with it, and I primarily use them for emphasis. If there's no real reason, then there's no real reason to include it. Take a gentleman who isn't a fan of communists: "Those dirty communists." "Those dirty communist bastards." "Those f**kin' communist bastards are filthy as hell." If the character really does not like communists for whatever reason, I'll go with the latter. In any case, I'll use what's appropriate, even if it may be inappropriate.