Need help w/ java class

User avatar
Waffles
Posts: 6876
Joined: Mon Dec 11, 2006 3:45 am

Need help w/ java class

Post by Waffles »

What was the error.

keep in mind you have to escape special characters like the &

http://www.mkyong.com/java/how-to-escap ... s-in-java/
Image
User avatar
sirricealot
Posts: 841
Joined: Sat Feb 19, 2011 3:35 pm

Need help w/ java class

Post by sirricealot »

java:44: error: no suitable method found for inde.....

d.indexOf("!", "@", "#", "$", "%", "^","&", "*");

Somehow it has to include one of the 8 special characters
2006 Chevy Cobalt SS/NA 2.4L IL: FEERME7
2010 Kawasaki Ninja 250r IL: RUNYON
xbxlive: sirricealot07
ps3: sirricealot7
David Runyon
User avatar
Waffles
Posts: 6876
Joined: Mon Dec 11, 2006 3:45 am

Need help w/ java class

Post by Waffles »

Read the link I posted, it explains the error.
Image
User avatar
sirricealot
Posts: 841
Joined: Sat Feb 19, 2011 3:35 pm

Need help w/ java class

Post by sirricealot »

Waffles;296967 wrote:Read the link I posted, it explains the error.
This whole freaking program is confusing. It's like I was covered in meat and thrown into the lion cage on this one. His podcast/ppt don't help either. I've got the motorcycle safety course tonight and all weekend as well so looks like I'll probably be turning in a partial assignment on this week :/.

I'm missing the ability to read the special character constraint, and the ability to print which constraints are still not met. One of the disadvantages of taking an online class :(.
2006 Chevy Cobalt SS/NA 2.4L IL: FEERME7
2010 Kawasaki Ninja 250r IL: RUNYON
xbxlive: sirricealot07
ps3: sirricealot7
David Runyon
User avatar
sirricealot
Posts: 841
Joined: Sat Feb 19, 2011 3:35 pm

Need help w/ java class

Post by sirricealot »

FML i was watching week 6 slideshow.
2006 Chevy Cobalt SS/NA 2.4L IL: FEERME7
2010 Kawasaki Ninja 250r IL: RUNYON
xbxlive: sirricealot07
ps3: sirricealot7
David Runyon
User avatar
sirricealot
Posts: 841
Joined: Sat Feb 19, 2011 3:35 pm

Need help w/ java class

Post by sirricealot »

Went through the slides and its still not clicking with me. Gonna email teacher I don't think I get it.
2006 Chevy Cobalt SS/NA 2.4L IL: FEERME7
2010 Kawasaki Ninja 250r IL: RUNYON
xbxlive: sirricealot07
ps3: sirricealot7
David Runyon
User avatar
Waffles
Posts: 6876
Joined: Mon Dec 11, 2006 3:45 am

Need help w/ java class

Post by Waffles »

Change "&" to "\&"

& is a reserved character so you need the \ escape character.
Image
User avatar
sirricealot
Posts: 841
Joined: Sat Feb 19, 2011 3:35 pm

Need help w/ java class

Post by sirricealot »

Waffles;296971 wrote:Change "&" to "&"

& is a reserved character so you need the escape character.
You just made that part a lot easier :lol2:

But implementing all 8 of the special characters into the string checking if one of any of them are in the password, thats the point where Im stuck
2006 Chevy Cobalt SS/NA 2.4L IL: FEERME7
2010 Kawasaki Ninja 250r IL: RUNYON
xbxlive: sirricealot07
ps3: sirricealot7
David Runyon
User avatar
Waffles
Posts: 6876
Joined: Mon Dec 11, 2006 3:45 am

Need help w/ java class

Post by Waffles »

If the index of the password is greater than -1 then one of them are in the password.
Image
User avatar
sirricealot
Posts: 841
Joined: Sat Feb 19, 2011 3:35 pm

Need help w/ java class

Post by sirricealot »

Waffles;296974 wrote:If the index of the password is greater than -1 then one of them are in the password.
int foundSymbol = password.indexOf("!@#$%^\&*");
if(foundSymbol >=0)


So that should work for any symbol?
2006 Chevy Cobalt SS/NA 2.4L IL: FEERME7
2010 Kawasaki Ninja 250r IL: RUNYON
xbxlive: sirricealot07
ps3: sirricealot7
David Runyon