Write a class that does the following: - Creates 10 instances of your person class with all the information filled in (names, email, username, password etc).//I am done with that - Prompts a user to enter their username and password.// done with that - if the username/password combination exists for one of your ten users then print out a welcome message as well as all the details of that user. // how do I determine that - if the username/password combination fails, allow them to try again. - if they have filled in the wrong username/password combo for 3 times, display a message informing them of this and quit.
You could try to determine if the user/pw exists with a case statement. If it finds a match, then print a welcome message. Once you get that working, then add the other 2 requirements. At least that's how I'd begin to approach the problem. Please post a copy or copies of some of the solutions you've tried and we can work through it.
Persistence and determination alone are omnipotent.<br />---Calvin Coolidge
How are you storing the 10 instances? Hopefully, you're using an array or some collection. maybe there is an easy way to circle around or through your objects, comparing the names on each one to what the user enters...
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Are you sure about a switch-case? You can't pass a String to a switch. See this part of the Java Tutorial. But you are correct that Vuthlarhi Donald ought to post some code, even if it doesn't work.
Joined: Jan 08, 2008
Thanks Campbell for straightening me out. I looked over the tutorial you suggested. Sorry for the bad advice, I guess I would have found that detail out rather quickly had I tried to use the case statement with a string. I'm a noob to all of this and thought I could learn some things by trying to answer questions....and I did!! I'll try to be more careful in the future, so as not to confuse other's "like me"....