Defendant pleads to attempted rape