Lock button on my iphone 4s is broken?

I got it less than a year ago, so it's still under warranty, if I make an appointment at the Apple store what would they do? Also, the back is cracked so would they still replace it?

Well, if the back wasn't cracked they'd probably give you a refurb replacement

It all depends on what the apple specialist wants to do.