import java.util.Scanner;
The class User {
Private String username;
Private String password;
Public String getUserName () {
Return the username.
}
Public void setUserName (String username) {
this.username=username;
}
Public String getPassword () {
return password;
}
Public void setPassword (String password) {
this.password=password;
}
}
Public class Dome {
Scanner input=new Scanner(System.in);
Public static void main (String [] args) {
The User [] users=new User [20];
for(int i=0; I<20; I++) {
The users [I]=new User ();
}
Int count=0;
The users [0]. SetUserName (" * * ");
The users [0]. SetPassword (" I am zhang SAN ");
Dome Dome=new Dome ();
//TODO Auto - generated method stub
Dome. The start ();
}
Public void the start () {
System. The out. Println (" -- logging on function for 1 - - - - ");
System. The out. Println (" -- 2 - registered function -- ");
System. The out. Println (" -- - 3 - delete function ");
System. The out. Println (" -- 4 - insert function - ");
System. The out. Println (" -- logging on function for 5 - - ");
System. The out. Println (" -- - 6 - exit function ");
While (true) {
System. The out. Println (" please enter a number: ");
The switch (input nextInt ()) {
Case 1:
This. The login ();
break;
Case 2:
Case 3:
Case 4:
Case 5:
Case 6: System. Exit (0); break;
Default: System. Out. Println (" please enter a number 1-6 "); This. The start ();
}
}
}
Public void the login () {
System. Out.println (" login is...... ");
System. The out. Print (" input the user name: ");
String username=input. Next ();
System. The out. Print (" please enter the password ");
String password=input. Next ();
//traverse to find the existence of a user name and password and have the check, no retreat to
For (User User: users) {//the users an error, I don't know how the
If (username. Equals (user. GetUserName ()) & amp; & Password. Equals (user. GetPassword ())) {
System. Out. Println (" validation by ");
System.out.println();
return;
}
The else {
System. The out. Println (" input error, please log in again ");
This. The login ();
}
}
}
}