java程序编写,读写文件并排序 5
我校校计算机专业招收研究生,共有两个专业方向:计算机应用,考试科目:数据结构,操作系统,组成原理软件工程,考试科目:数据结构,操作系统,面向对象程序设计每个学生考试时要填...
我校校计算机专业招收研究生,共有两个专业方向:
计算机应用,考试科目:数据结构,操作系统,组成原理
软件工程,考试科目:数据结构,操作系统,面向对象程序设计
每个学生考试时要填写(考号、姓名、身份证号)
实现以下功能:1、采用继承实现类的设计
2、分别求出各专业考生的平均成绩、且输出各专业的排名.
class ComputerSpe {
private String stu_No; //考号
private String stu_Name; //姓名
private String stu_IDCard; //身份证
private double stu_AveGrade; //平均成绩
private double grade_DataStru; //数据结构
private double grade_OS; //操作系统
protected ComputerSpe(){}
protected ComputerSpe(String no,String name,String idCard,double datastru,double os){
this.stu_No = no;
this.stu_Name = name;
this.stu_IDCard = idCard;
this.grade_DataStru= datastru;
this.grade_OS=os;
}
public double getStu_AveGrade() {
return stu_AveGrade;
}
public void setStu_AveGrade(double stu_AveGrade) {
this.stu_AveGrade = stu_AveGrade;
}
public double getGrade_DataStru() {
return grade_DataStru;
}
public void setGrade_DataStru(double grade_datastru) {
this.grade_DataStru = grade_datastru;
}
public double getGrade_OS() {
return grade_OS;
}
public void setGrade_OS(double grade_os) {
this.grade_OS = grade_os;
}
public String getStu_IDCard() {
return stu_IDCard;
}
public void setStu_IDCard(String stu_IDCard) {
this.stu_IDCard = stu_IDCard;
}
public String getStu_Name() {
return stu_Name;
}
public void setStu_Name(String stu_Name) {
this.stu_Name = stu_Name;
}
public String getStu_No() {
return stu_No;
}
public void setStu_No(String stu_No) {
this.stu_No = stu_No;
}
public double countAve() {return 0;}//计算平均成绩
public void sort(ComputerSpe[] spe){ //插入法排序
for(int i=0;i<spe.length;i++){
int j;
ComputerSpe temp =spe[i];
for(j=i;j>0 && spe[j-1].getStu_AveGrade()<temp.getStu_AveGrade();j--){
spe[j] = spe[j-1];
}
spe[j] = temp;
}
}
public void display(){}; //显示成绩及排名
} 展开
计算机应用,考试科目:数据结构,操作系统,组成原理
软件工程,考试科目:数据结构,操作系统,面向对象程序设计
每个学生考试时要填写(考号、姓名、身份证号)
实现以下功能:1、采用继承实现类的设计
2、分别求出各专业考生的平均成绩、且输出各专业的排名.
class ComputerSpe {
private String stu_No; //考号
private String stu_Name; //姓名
private String stu_IDCard; //身份证
private double stu_AveGrade; //平均成绩
private double grade_DataStru; //数据结构
private double grade_OS; //操作系统
protected ComputerSpe(){}
protected ComputerSpe(String no,String name,String idCard,double datastru,double os){
this.stu_No = no;
this.stu_Name = name;
this.stu_IDCard = idCard;
this.grade_DataStru= datastru;
this.grade_OS=os;
}
public double getStu_AveGrade() {
return stu_AveGrade;
}
public void setStu_AveGrade(double stu_AveGrade) {
this.stu_AveGrade = stu_AveGrade;
}
public double getGrade_DataStru() {
return grade_DataStru;
}
public void setGrade_DataStru(double grade_datastru) {
this.grade_DataStru = grade_datastru;
}
public double getGrade_OS() {
return grade_OS;
}
public void setGrade_OS(double grade_os) {
this.grade_OS = grade_os;
}
public String getStu_IDCard() {
return stu_IDCard;
}
public void setStu_IDCard(String stu_IDCard) {
this.stu_IDCard = stu_IDCard;
}
public String getStu_Name() {
return stu_Name;
}
public void setStu_Name(String stu_Name) {
this.stu_Name = stu_Name;
}
public String getStu_No() {
return stu_No;
}
public void setStu_No(String stu_No) {
this.stu_No = stu_No;
}
public double countAve() {return 0;}//计算平均成绩
public void sort(ComputerSpe[] spe){ //插入法排序
for(int i=0;i<spe.length;i++){
int j;
ComputerSpe temp =spe[i];
for(j=i;j>0 && spe[j-1].getStu_AveGrade()<temp.getStu_AveGrade();j--){
spe[j] = spe[j-1];
}
spe[j] = temp;
}
}
public void display(){}; //显示成绩及排名
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询