```package code;
import code.User;
import code.Student;
import java.awt.*;
import javax.swing.JOptionPane;
public class DataHandle
{
User[] users = new User[4];
users[0] = new User("Tom","moT");
users[1] = new User("Jeff","ffeJ");
users[2] = new User("Dan","naD");
users[3] = new User("Jerry","yrreJ");
Student[] students = new Student[5];
int count = 0;
boolean CheakName (String name)
{
for (int count = 0; count < 4; count++)
if (users[count].getName() == name)
return true;
return false;
}
boolean CheakPassword (String password)
{
for (int count = 0; count < 4; count++)
if (users[count].getPassword() == password)
return true;
return false;
}
void RecordIn (int INPUT1, int INPUT2, int INPUT3, int INPUT4, String INPUT5)
{
if (count == 4)
{
JOptionPane.showMessageDialog(null, "The storage is already full");
}
students[count] = new Student(INPUT1,INPUT2,INPUT3,INPUT4,INPUT5);
count++;
}
void sortStudents ()
{
for (int countO = 0; countO < count-1; countO++)
for (int countI = countO; countI < count; countI++)
if (students[countO].getNumber() > students[countI].getNumber())
{
Student swap = new Student(students[countI].getNumber(),
students[countI].getChinese(),
students[countI].getEnglish(),
students[countI].getMath(),
students[countI].getName());
students[countI].setNumber(students[countO].getNumber());
students[countI].setChinese(students[countO].getChinese());
students[countI].setEnglish(students[countO].getEnglish());
students[countI].setMath(students[countO].getMath());
students[countI].setName(students[countO].getName());
students[countO].setNumber(swap.getNumber());
students[countO].setChinese(swap.getChinese());
students[countO].setEnglish(swap.getEnglish());
students[countO].setMath(swap.getMath());
students[countO].setName(swap.getName());
}
}
Student Serch (int INPUT)
{
for (int Count = 0; Count < count; Count++)
if (students[Count].getNumber() == INPUT)
return students[Count];
JOptionPane.showMessageDialog(null, "The student is not exsist");
}
Student Serch (String INPUT)
{
for (int Count = 0; Count < count; Count++)
if (students[Count].getName() == INPUT)
return students[Count];
JOptionPane.showMessageDialog(null, "The student is not exsist");
}
}
错误在第9至17行
错误提示如下:
第9行:Syntax error on token ";", { expected after this token
第17行:Syntax error, insert "}" to complete Block