/Users/asimsayed/NetBeansProjects/JavaApplication1/src/NewMain2.java
 1 import java.util. Scanner;
 2 
 3 public class NewMain2 {
 4 
 5         public static void main(String[] args) 
 6         {
 7 
 8         Scanner keyedInput = new Scanner(System.in);      
 9 
10         String pWord, uName;
11 
12         final String teacherUName = "teacher";
13         final String teacherPWord = "lovetoteach";
14         final String studentUName = "student";
15         final String studentPWord = "lovetolearn";
16 
17         int times = 0;
18 
19         System.out.println ("*********************");
20         System.out.println ("***CAREER EXPLORER***");
21         System.out.println ("*********************");
22         System.out.println ();
23 
24         System.out.println ("Welcome to the career explorer program.");
25         System.out.println ("Please enter you username and password.");
26         System.out.println ();
27 
28         while (times <3)
29         {
30         System.out.print ("Username (must be between 6 and 12 characters long): ");
31         uName = keyedInput.next();
32         System.out.print ("Password (must be between 6 and 12 characters long): ");
33         pWord = keyedInput.next();
34         
35             if (uName.length () < 6 | uName.length () >12 | pWord.length () < 6 | pWord.length () >12 )
36                 {
37                     System.out.println ("Sorry, either your username or password was not between 6 and 12 characters.");
38                     System.out.println ();
39                     times = times + 1;
40                 }
41             else if (uName.equals(teacherUName) & pWord.equals(teacherPWord))
42                 {
43                     System.out.println ("Welcome teacher, to the career explorer software!");
44                     break;
45                 }
46             else if (uName.equals(studentUName) & pWord.equals(studentPWord))
47                 {
48                     System.out.println ("Welcome student, to the career explorer software!");
49                     break;
50                 }
51             else
52                 {
53                     System.out.println ("Sorry, you have inputted a username or password that is incorrect.");
54                     System.out.println ();
55                     times = times + 1;
56                 }
57         }
58 
59         if (times ==3)
60         {
61         System.out.println ("Sorry, you have tried 3 times. You will now be locked out.");
62         }
63     }
64 
65 }
66 
67 
68