JAVA学生录取系统Word版
传播优秀Word版文档 ,希望对您有帮助,可双击去除!要求:Java编程/*编写程序实现如下功能:已知学生类变量(姓名、考号、综合成绩、体育成绩)和方法(获取综合成绩、获取体育成绩、显示基本信息),学校类有变量(录取分数线)和方法(设置录取分数、获取录取分数线),录取类有方法(获取学生是否符合录取条件,其中录取条件为综合成绩在录取分数线之上,或体育成绩在96分以上并且综合成绩大于300分)。现要求编写程序输出一组学生对象中被某学校录取的学生基本信息。*/1.Schools类import java.util.*;public class Schools private double scoreLine; /录取分数线private String schoolName; /学校名称private int number; /入取人数public int getNumber() return number;public void setNumber(int number) doif(number0)this.number = number;break;传播优秀Word版文档 ,希望对您有帮助,可双击去除!elseSystem.out.println(录取人数错误,请重输);continue;while(true);Scanner sc=new Scanner(System.in);public String getSchoolName() return schoolName;public void setSchoolName(String schoolName) this.schoolName = schoolName;public double getScoreLine() return scoreLine;public void setSchoolLine(double SchoolLine) public void setScoreLine(Schools schools) 传播优秀Word版文档 ,希望对您有帮助,可双击去除!for(int i=0;i300)setSchoolLine(scoreLine1);elseSystem.out.println(录取分数线错误,请重新输入);i=i-1;continue;public Schools()2. Students类import java.util.*;public class Students Scanner sc=new Scanner(System.in);private String name; /姓名传播优秀Word版文档 ,希望对您有帮助,可双击去除!private int ID; /考号private double allScore; /综合成绩private double sportScore; /体育成绩private String firstHope; /第一志愿private String secondHope; /第二志愿public String getFirstHope() return firstHope;/确定第一志愿public void setFirstHope(String setFirstHope)this.firstHope=setFirstHope;public void setSecondHope(String setSecondHope)this.secondHope=setSecondHope;public void setFirstHope(Students student) doSystem.out.println(请输入第一志愿1.北京大学;2.南京大学);int choice=Integer.parseInt(sc.nextLine();if(choice=1)student.setFirstHope(北京大学);break;传播优秀Word版文档 ,希望对您有帮助,可双击去除!else if(choice=2)student.setFirstHope(南京大学);break;elseSystem.out.println(无此学校,请重输);continue;while(true);public String getSecondHope() return secondHope;/确定第二志愿public void setSecondHope(Students student) doSystem.out.println(请输入第二志愿1.北京大学;2.南京大学);int choice=Integer.parseInt(sc.nextLine();if(choice=1&!student.getFirstHope().equals(北京大学)student.setSecondHope(北京大学);传播优秀Word版文档 ,希望对您有帮助,可双击去除!break;else if(choice=2&!student.getFirstHope().equals(南京大学)student.setSecondHope(南京大学);break;elseSystem.out.println(无此学校,或者与第一志愿重复,请重输);continue;while(true);public String getName() return name;public void setName(String name) this.name = name;public int getID() return ID;public void setID(Students students) do传播优秀Word版文档 ,希望对您有帮助,可双击去除!System.out.println(请输入学生考号);int ID=Integer.parseInt(sc.nextLine();for(int i=0;i=0)传播优秀Word版文档 ,希望对您有帮助,可双击去除!setAllScore(allscore1);break;elseSystem.out.println(综合成绩错误,请重新输入);continue;while(true);public double getSportScore() return sportScore;public void setSportScore(double score) public void setSportScore() doSystem.out.println(请输入体育成绩);double sportscore1=Double.parseDouble(sc.nextLine();if(sportscore1=0)setSportScore(sportscore1);break;elseSystem.out.println(体育成绩错误,请重新输入);continue;传播优秀Word版文档 ,希望对您有帮助,可双击去除!while(true);public void showInformation(Students student)System.out.println(学生姓名为:+student.getName()+ 学生考号为:+student.getID()+ 综合成绩为+student.getAllScore()+ 体育成绩为+student.getSportScore();/构造器public Students(String name,int ID,double allScore,double sportScore)this.name=name;this.ID=ID;this.allScore=allScore;this.sportScore=sportScore;public Students() / TODO Auto-generated constructor stub3. Enter类(录取类)public class Enter Students student1=new Students();传播优秀Word版文档 ,希望对您有帮助,可双击去除!/判断录取public void enter(Students students,Schools schools)for(int i=0;i96)studentsi.setAllScore(0);for(int i=1;istudentsj+1.getAllScore()Students temp;temp=studentsj;studentsj=studentsj+1;studentsj+1=temp;int sum=0;int sum1=0;for(int i=0;ischools0.getScoreLine()sum=sum+1;System.out.println(恭喜被北大录取);传播优秀Word版文档 ,希望对您有帮助,可双击去除!student1.showInformation(studentsi);else if(studentsi.getFirstHope().equals(南京大学)&sum1schools1.getScoreLine()sum1=sum1+1;System.out.println(恭喜被南京大学录取);student1.showInformation(studentsi);else if(sumschools0.getNumber()&studentsi.getSecondHope().equals(南京大学)&studentsi.getAllScore()schools1.getScoreLine()sum1=sum1+1;System.out.println(恭喜被南京大学录取);student1.showInformation(studentsi);else if(sum1schools1.getNumber()&studentsi.getSecondHope().equals(北京大学)&studentsi.getAllScore()schools0.getScoreLine()sum=sum+1;System.out.println(恭喜被北大录取);student1.showInformation(studentsi);else if(sumschools0.getNumber()&sum1schools1.getNumber()System.out.println(学校人数已满无法录取);break;传播优秀Word版文档 ,希望对您有帮助,可双击去除!4. Demo类(操作类)import java.util.*;public class Demo Scanner sc=new Scanner(System.in);Students students; Schools schools=new Schools2 ;Schools school=new Schools();Enter en=new Enter();/确定两所大学分数线public void main()schools0=new Schools();schools0.setSchoolName(北京大学);System.out.println(请输入北京大学录取人数);int num1=Integer.parseInt(sc.nextLine();schools0.setNumber(num1);schools1=new Schools();schools1.setSchoolName(南京大学);System.out.println(请输入南京大学录取人数);int num2=Integer.parseInt(sc.nextLine();schools1.setNumber(num2);school.setScoreLine(schools);/输入学生信息传播优秀Word版文档 ,希望对您有帮助,可双击去除!doSystem.out.println(请输入学生位数);int num=Integer.parseInt(sc.nextLine();if(num0)students=new Studentsnum;for(int i=0;istudents.length;i+)studentsi=new Students();System.out.println(请输入学生姓名);String name=sc.nextLine();studentsi.setName(name);studentsi.setID(students);studentsi.setAllScore();studentsi.setSportScore();studentsi.setFirstHope(studentsi);studentsi.setSecondHope(studentsi);/break;elseSystem.out.println(学生个数错误,请重输);continue;while(true);en.enter(students,schools);传播优秀Word版文档 ,希望对您有帮助,可双击去除!public static void main(String args) / TODO Auto-generated method stubDemo de = new Demo();de.main(