Measure the windowsill and piece of plywood to determine what size the bed will be. If necessary, cut the plywood to fit the windowsill length.
Trace the piece of plywood onto the back of the carpeting, using a marker.
Cut the carpeting 2 inches outside the outline, using a craft knife.
Put the carpeting face down on a hard surface with the plywood inside the outlined area.
Starting in the center of each side, pull the edge of the carpeting tight around the back of the plywood and staple into place with a staple gun.
Staple out from the center, attaching the carpeting to the back of the plywood.
Trim the carpeting at the corners and staple any loose carpeting to secure it to the plywood.
Screw one shelf bracket to each end of one long side of the plywood, 2 inches from the edge.
Mount the bed to the wall just below the windowsill, using the remaining screws.