There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Enter your user name: raja
Enter your password: k9
Welcome rajaException in thread "main"
Enter your user name: java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Scanner.java:1533)
at login.Scan(login.java:15)
at login.main(login.java:78)
Enter your user name: yhtt
Enter your password: tyuu
You dont have valid credentialsException in thread "main"
Enter your user name: java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Scanner.java:1533)
at login.Scan(login.java:15)
at login.Cred(login.java:46)
at login.Scan(login.java:24)
at login.main(login.java:78)
Enter your user name: raja
Enter your password: k9
Welcome raja
Enter your user name:
Enter your user name: rr
Enter your password: rr
You dont have valid credentials
Enter your user name: tt
Enter your password: tt
You dont have valid credentials
Enter your user name: yy
Enter your password: yy
You dont have valid credentials
Enter your user name:
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
You have 3 attempts to logon
Enter your user name: raja
Enter your password: k9
Welcome raja
You have 3 attempts to logon
Enter your user name: ee
Enter your password: ee
Invalid user: That was attempt nr 1
Enter your user name: ee
Enter your password: ee
Invalid user: That was attempt nr 2
Enter your user name: ee
Enter your password: ee
You attempted to access the system 2 times
when the desired result should be "3 times"You attempted to access the system 2 times
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Invalid user: That was attempt nr 2
2nd and final attempt
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
You have 3 attempts to logon
Enter your user name: raja
Enter your password: k9
Welcome raja
You have 3 attempts to logon
Enter your user name: ee
Enter your password: ee
Invalid user: That was attempt nr 1
Enter your user name: ee
Enter your password: ee
Invalid user: That was attempt nr 2
This 3rd login will be your final attempt
Enter your user name: ee
Enter your password: ee
You had 3 failed attempts
Don't touch me. And dont' touch this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
|