That error likely means the hard drive is toast, which is probably why your friend gave it to you.
The
iMac G4 never had a slot loading drive. When it powers on, hold down the Apple-Option-O-F keys. When you see black text on a white background, type:
eject cd
And hit return. Out comes the drive. Insert the Leopard disc and reboot. Hold down the C key. When it boots up, go to the Utilities menu and open Disk Utility. Zero the drive. Don't just format it. Use the additional options and completely overwrite it. If the format fails then you're almost certainly looking at a hosed drive.