public class StudentScoreTest
{
public static void main(String args[])throws IOException
{
String k,n,s;
int a;
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.println("请输入最大学生人数:");
s= in.readLine();
a=Integer.parseInt(s);
StudentScore sg=new StudentScore(a);
Student x=new Student("李四","002",86,92,97,3.7,"345");
Student y=new Student("张三","001",90,95,96,4.0,"123");
sg.append(x);
sg.append(y); while(true)
{
System.out.println("**请选择您的身份**");
System.out.println(" 0.退出系统");
System.out.println(" 1.用户");
System.out.println(" 2.管理员");
System.out.println("***************");
k=in.readLine();
a=Integer.parseInt(k);
if((a==0)||(a==1)||(a==2))
break;
}
while(true)
{
switch(a)
{
case 1:
{
System.out.println("**请输入您的学号**");
n=in.readLine();
while(true){
if(sg.search(n)!=-1)
break;
System.out.println("该学生不存在");
}
while(true){
System.out.println("**请输入您的密码**");
k=in.readLine();
if(k.equals(sg.stu[sg.search(n)].getKey()))
break;
System.out.println("密码错误,请重新输入。");
}
Student z1=new Student();
break;
}
case 2:
while(true)
{
System.out.println("**请输入您的密码**");
k=in.readLine();
if(k.equals("1"))
break;
System.out.println("密码错误,请重新输入。");
}
Admin z2=new Admin(sg.stu);
break;
}
if (a==0)
{
System.out.println("谢谢您使用本系统!");
break;
}
}
}
}
{
public static void main(String args[])throws IOException
{
String k,n,s;
int a;
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.println("请输入最大学生人数:");
s= in.readLine();
a=Integer.parseInt(s);
StudentScore sg=new StudentScore(a);
Student x=new Student("李四","002",86,92,97,3.7,"345");
Student y=new Student("张三","001",90,95,96,4.0,"123");
sg.append(x);
sg.append(y); while(true)
{
System.out.println("**请选择您的身份**");
System.out.println(" 0.退出系统");
System.out.println(" 1.用户");
System.out.println(" 2.管理员");
System.out.println("***************");
k=in.readLine();
a=Integer.parseInt(k);
if((a==0)||(a==1)||(a==2))
break;
}
while(true)
{
switch(a)
{
case 1:
{
System.out.println("**请输入您的学号**");
n=in.readLine();
while(true){
if(sg.search(n)!=-1)
break;
System.out.println("该学生不存在");
}
while(true){
System.out.println("**请输入您的密码**");
k=in.readLine();
if(k.equals(sg.stu[sg.search(n)].getKey()))
break;
System.out.println("密码错误,请重新输入。");
}
Student z1=new Student();
break;
}
case 2:
while(true)
{
System.out.println("**请输入您的密码**");
k=in.readLine();
if(k.equals("1"))
break;
System.out.println("密码错误,请重新输入。");
}
Admin z2=new Admin(sg.stu);
break;
}
if (a==0)
{
System.out.println("谢谢您使用本系统!");
break;
}
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货