Back up all data to at least two different storage devices, if you haven't already done so. There are ways to back up a computer that isn't fully functional. Ask if you need guidance.
Erase and install OS X. This operation will destroy all data on the startup volume, so you had be better be sure of your backups. If your Mac was upgraded from an older version of OS X, you may need the Apple ID and password you used.
If you use FileVault 2, then in Disk Utility select the icon of the FileVault volume ("Macintosh HD," unless you gave it a different name.) It will be nested below another icon with the same name. Click the Unlock button in the toolbar and enter your login password when prompted.
When you restart the computer, the Setup Assistant will launch to take you through the initial setup process. Follow the prompt to transfer the data from one of your backups. Don't transfer the Guest account, if it was enabled on the old system.
If you installed the Java runtime distributed by Apple and still need it, you'll have to reinstall it. The same goes for Xcode.