JAVA学生录取系统方案.docx

上传人:b****3 文档编号:2444231 上传时间:2022-10-29 格式:DOCX 页数:12 大小:16.47KB
下载 相关 举报
JAVA学生录取系统方案.docx_第1页
第1页 / 共12页
JAVA学生录取系统方案.docx_第2页
第2页 / 共12页
JAVA学生录取系统方案.docx_第3页
第3页 / 共12页
JAVA学生录取系统方案.docx_第4页
第4页 / 共12页
JAVA学生录取系统方案.docx_第5页
第5页 / 共12页
点击查看更多>>
下载资源
资源描述

JAVA学生录取系统方案.docx

《JAVA学生录取系统方案.docx》由会员分享,可在线阅读,更多相关《JAVA学生录取系统方案.docx(12页珍藏版)》请在冰豆网上搜索。

JAVA学生录取系统方案.docx

JAVA学生录取系统方案

要求:

Java编程

/*编写程序实现如下功能:

已知学生类变量(姓名、考号、综合成绩、体育成绩)和方法

(获取综合成绩、获取体育成绩、显示基本信息),学校类有变量(录取分数线)和方法

(设置录取分数、获取录取分数线),录取类有方法(获取学生是否符合录取条件,

其中录取条件为综合成绩在录取分数线之上,

或体育成绩在96分以上并且综合成绩大于300分)。

现要求编写程序输出一组学生对象中被某学校录取的学生基本信息。

*/

1.Schools类

importjava.util.*;

publicclassSchools{

privatedoublescoreLine;//录取分数线

privateStringschoolName;//学校名称

privateintnumber;//入取人数

publicintgetNumber(){

returnnumber;

}

publicvoidsetNumber(intnumber){

do{

if(number>0){

this.number=number;

break;

}

else{

System.out.println("录取人数错误,请重输");

continue;

}

}while(true);

}

Scannersc=newScanner(System.in);

publicStringgetSchoolName(){

returnschoolName;

}

publicvoidsetSchoolName(StringschoolName){

this.schoolName=schoolName;

}

publicdoublegetScoreLine(){

returnscoreLine;

}

publicvoidsetSchoolLine(doubleSchoolLine){}

publicvoidsetScoreLine(Schools[]schools){

for(inti=0;i

System.out.println("请输入"+schools[i].getSchoolName()+"录取分数线");

doublescoreLine1=Double.parseDouble(sc.nextLine());

if(scoreLine1>300){

setSchoolLine(scoreLine1);

}else{

System.out.println("录取分数线错误,请重新输入");

i=i-1;

continue;

}

}

}

publicSchools(){

}

}

 

2.Students类

importjava.util.*;

publicclassStudents{

Scannersc=newScanner(System.in);

privateStringname;//姓名

privateintID;//考号

privatedoubleallScore;//综合成绩

privatedoublesportScore;//体育成绩

privateStringfirstHope;//第一志愿

privateStringsecondHope;//第二志愿

publicStringgetFirstHope(){

returnfirstHope;

}

//确定第一志愿

publicvoidsetFirstHope(StringsetFirstHope){

this.firstHope=setFirstHope;

}

publicvoidsetSecondHope(StringsetSecondHope){

this.secondHope=setSecondHope;

}

publicvoidsetFirstHope(Studentsstudent){

do{

System.out.println("请输入第一志愿1.北京大学;2.南京大学");

intchoice=Integer.parseInt(sc.nextLine());

if(choice==1){

student.setFirstHope("北京大学");

break;

}elseif(choice==2){

student.setFirstHope("南京大学");

break;

}

else{

System.out.println("无此学校,请重输");

continue;

}

}while(true);

}

publicStringgetSecondHope(){

returnsecondHope;

}

//确定第二志愿

publicvoidsetSecondHope(Studentsstudent){

do{

System.out.println("请输入第二志愿1.北京大学;2.南京大学");

intchoice=Integer.parseInt(sc.nextLine());

if(choice==1&&!

student.getFirstHope().equals("北京大学")){

student.setSecondHope("北京大学");

break;

}elseif(choice==2&&!

student.getFirstHope().equals("南京大学")){

student.setSecondHope("南京大学");

break;

}

else{

System.out.println("无此学校,或者与第一志愿重复,请重输");

continue;

}

}while(true);

}

publicStringgetName(){

returnname;

}

publicvoidsetName(Stringname){

this.name=name;

}

publicintgetID(){

returnID;

}

publicvoidsetID(Students[]students){

do{

System.out.println("请输入学生考号");

intID=Integer.parseInt(sc.nextLine());

for(inti=0;i

if(ID==students[i].getID()){

System.out.println("考号存在请重输");

break;

}else{

this.ID=ID;

return;

}

}

}while(true);

}

publicdoublegetAllScore(){

returnallScore;

}

publicvoidsetAllScore(doubleallScore){

this.allScore=allScore;

}

publicvoidsetAllScore(){

do{

System.out.println("请输入综合成绩");

doubleallscore1=Double.parseDouble(sc.nextLine());

if(allscore1>=0){

setAllScore(allscore1);

break;

}else{

System.out.println("综合成绩错误,请重新输入");

continue;

}

}while(true);

}

publicdoublegetSportScore(){

returnsportScore;

}

publicvoidsetSportScore(doublescore){}

publicvoidsetSportScore(){

do{

System.out.println("请输入体育成绩");

doublesportscore1=Double.parseDouble(sc.nextLine());

if(sportscore1>=0){

setSportScore(sportscore1);

break;

}else{

System.out.println("体育成绩错误,请重新输入");

continue;

}

}while(true);

}

publicvoidshowInformation(Studentsstudent){

System.out.println("学生姓名为:

"+student.getName()+"学生考号为:

"+student.getID()+"综合成绩为"+student.getAllScore()+"体育成绩为"+student.getSportScore());

}

//构造器

publicStudents(Stringname,intID,doubleallScore,doublesportScore){

this.name=name;

this.ID=ID;

this.allScore=allScore;

this.sportScore=sportScore;

}

publicStudents(){

//TODOAuto-generatedconstructorstub

}

}

3.Enter类(录取类)

publicclassEnter{

Studentsstudent1=newStudents();

//判断录取

publicvoidenter(Students[]students,Schools[]schools){

for(inti=0;i

if(students[i].getSportScore()>96){

students[i].setAllScore(0);

}

}

for(inti=1;i<=students.length-1;i++){

for(intj=0;j

if(students[j].getAllScore()>students[j+1].getAllScore()){

Studentstemp;

temp=students[j]

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 经济市场

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1