My iPhone turns off and my battery percentage is stuck?

Around a month ago, my iPhone started shutting itself down, but instead of doing it straight away, the screen would fade in vertical stripes, and then it would turn back on. If my phone is charging, it will also do this but get to around 40% - 80% battery percentage and the battery percentage doesn't change at all. I tried to reset my phone but still nothing worked, my phone doesn't stay on long enough to restore any of my backups. Literally 2 days afters my warranty ran out, this began to happen. Why is this happening and how can I solve it? Thanks!

Added (1). I have an iPhone 4S, it's only a year old!

It might be a hardware problem with your battery. There's a software called iPhone Configruation Utility from Apple where you can see error messages. Install that, connect your iphone to computer, select device from list on the left and then select console tab on the right. It is ok to have a few error or warning messages but if there are many of them and they are periodical most probably it is an hardware error. Otherwise it could be a software issue and you could try to restore firmware in DFU mode.

  • Why does the last percentage of my iphone battery takes so long to charge? I have noticed that the very first percentages (1-20) of the iphone battery charges very quickly, but when it comes to the last percentage (99-100) it takes like 15 minutes to charge!
  • What to do if your iPhone 4S battery percentage is stuck and won't change? My iphone battery percentage is stuck at 100% and I don't know what to do. The only time my battery percentage changes is if I turn my phone off and back on and it'll be on the real battery percentage but it'll still be stuck. Can someone help me with this problem?
  • Why battery percentage indicator in iphone is not showing accurate battery? Let its being charged, let it reached 97 percent, it will still showing charging, but if i off/on it, it will show 100 percent, and it shuts off when it reaches 4 percent, please tell what's problem? and as above i said, if i go to "usage" it will show time charged last time:0 mins standby:0mins but at top right its 99percent and is showing charging?
  • My iPhone keeps turning on and off like it turns on and off. Can someone tell me? Okay tbms it turns on and off on and off and then sometimes it shows a red screen for a few seconds then off again and dies out. It's not the battery because I got that changed thinking that it was the cause and it wasn't. So is there anything someone can help me with? The repair guy tried restoring it through iTunes he said it didn't work either it just won't come on it doesn't go pass the Apple logo before shutting off and on again and dying out