Measure from the bottom of the bookcase to a point five feet high and mark that distance on the bookcase. Transfer that distance all the way around the bookcase, including sides and back boards. Set the bookcase down on its back and put something under it to raise it off the ground by a few inches.
Cut the bookcase into a three-foot section and a five-foot section by cutting along the previously made line with the saw. Sand the rough edges if necessary to eliminate any risk of splinters or cuts.
Stand up both parts of the bookcase on their cut edges, in the positions they will be in for the bed. Put the three-foot part in front of the five-foot part, with the shelving sides facing the same direction. Arrange the new headboard and footboard so that there is exactly 76 inches of space between them.
Measure the distance from the front of the rear board on the inside of the headboard to the back of the footboard. Cut two 2-by-4 boards to match this measurement. Position one of the boards against the inside edge of the headboard's side about eight inches off the ground with the larger side of the board flush against the headboard's side and the end of the board flush against the rear board.
Predrill three holes through the back of the headboard and into the end of the 2-by-4 and then attach the boards together by drilling three-inch wood screws in those holes. Predrill two holes through the outside of the headboard's side and into the 2-by-4 and then attach those boards together by drilling the two-inch wood screws into the holes.
Set the carpenter's level on top of the 2-by-4 and position it on the rear of the footboard so that it is level. Predrill three holes through the front of the footboard's rear board and into the end of the 2-by-4. Attach the boards together by drilling in three-inch wood screws. Repeat to install the other 2-by-4.
Measure the distance between the 2-by-4 boards from outside edge to outside edge and cut six 2-by-4 boards of that length with the saw to serve as mattress supports. Position the mattress supports evenly on top of the longer 2-by-4s and with their largest surfaces facing down. Predrill two holes down through each mattress support and into each of the long 2-by-4s, so there are 12 holes in all. Attach the mattress supports to the long 2-by-4s with the three-inch wood screws.