Try to get interested about things you have to do for homework. If you do, it will get much easier. Also, make some simple goals, like: "I will do one more page, and then I can have a cookie (or something)". Sounds funny, but it works ;)
Ok i think yea you should listen in class to make it easier but to make it fun, you can challenge yourself in something, listen to music, or ask the teacher if you can do your homework in a more creative way.
To pass the time, do the homeworks while listening to music, but don't get distracted ! Understand the subjects mostly and have interest in them because if you don't, you'll hate them and think of them as hard work to deal with. Before starting your work, clear your mind from having negative or degrading thoughts about the work, and start afresh. Always have reference books, or the Internet everytime doing them. Life would be much more easier ^_^
Procrastination trick: reward yourself anytime you finish a couple of paragraphs, a page of problems, several chapters, or a chunk of the assignment. This way your brain subconsciously learns "Do work, get an award" and you'll be finishing work in a matter of minutes. I use junk food for my award.
Do homework with friends THAT WILL NOT MAKE YOU DISTRACTED Pay attention in class. Who knows, maybe you're teacher could sneak a few answers into a lesson Reward yourself. For ever good grade you get, maybe go out and have a little fun, get a treat. Something to convince yourself to get good grades. Take breaks between homework. Maybe after you do one part of your work, sit down for 5 minutes and relax.