Measure the mattress. You'd think that all twin mattresses would come in a standard size, but they don't. Measure the dimensions and cut your sheet of plywood to give you a 1 inch buffer (extra) on every edge (2 inches longer and 2 inches wider than the mattress).
Cut two 2-by-8 feet length boards exactly the same length as the plywood. Cut the width boards 3 inches wider than the plywood to account for the extra width created by the 2x8 (actually only 1 1/2" wide) length-boards.
Sand everything. You now have all the basic, touchable pieces cut out. Depending on the quality of the lumber, you may have potential spliters galore! Take the time to sand all the flat surfaces and especially all the edges. If they're really bad, you may have to use a hand plane or rasp to work the splintery pieces down. It's better to do this now than later.
Screw the width boards to the length boards. If you pre-drill starter holes, you'll have an easier times sinking the screws just a bit so that nothing jagged sticks out. Make sure that you start by screwing the shorter boards onto the ends of the longer boards. That way, the pre-cut plywood base will fit perfectly into the box-opening.
Cut one of the 2-by-2 boards to fit the width of the box at each end of the box. Then cut two more to fit the remaining space, 3 inches shorter than the actual length of the box. These, once screwed into the bottom of the box, will form a lip that will support the plywood.
Glue the end pieces, and then screw them into the box from the inside. (Don't skimp on screws.) Then, glue and screw the length pieces, again from the inside. As before, pre-drilling will make it easier.
Place the plywood into the opening; it should rest tightly against the 2-by-2 lip. Screw the shorter screws through the plywood into the 2-by-2 lip, and a few longer ones at an angle into the sides of the platform.
Supporting the platform is a matter of cutting legs at your desired height. You can use a dresser at one end, or a bookshelf, or a desk - or even at both ends! (If they match!)
If you cut legs out of 2-by-8 lumber, you need to add diagonals in both directions to prevent sway. Use the lag bolts to attach legs to the platform. Place them as deep into the corners of the platform as you can so that putting sheets on the bed isn't dangerous to your fingers. You can also screw the legs or platform itself right into the wall if you want to add stability. You can use the lag screws for that operation.