[说明]某数据文件students.txt的内容为100名学生的学号和成绩,下面的程

题型:填空题

问题:

[说明]

某数据文件students.txt的内容为100名学生的学号和成绩,下面的程序将文件中的数据全部读入对象数组,按分数从高到低进行排序后,选出排名前30%的学生。

[Java代码]

import Java.io.*;

class Student

private string sNO; //学号

private int credit; //分数

public int getCredit ()

return Credit;

public String toString ()

return"sNO="+this.sNO+", Credit="+this.Credit;

Student(String sNO, int Credit)

(1) =sNO;

(2) =Credit;

public class SortStudent

void sort(Student[] s) //Sort the array s[] in descending order of

Credit

for (int i=0; i < s.length-1; i++)

for (int j=i+1; j < s.length; j++)

if (s[i]. (3) < s[j]. (4) )

Student tmp=s[i];

s[i]=s[j];

s[j]=tmp;

public static void main(String argv[])

Student[] testStudent = new Student[size];

try

BufferedReader in = new BufferedReader(new FileReader

("Students.txt"));

boolean done = false;

int i = 0;

while (!done)

String s = in.readLine(); //每次读取一个学生的学号和成绩

if (s !=null)

String tmp[] = s.split(",");

testStudent[i++] = (5) (tmp[0], Integer.parseInt

(tmp[1]));

else

done = true;

in.close();

(6) =new SortStudent();

ss.sort(testStudent);

System.out.println("top 30%:");

for (int j = 0; j < size * 0.3; j++)

System.out.println(testStudent[j]);

catch (IOException e)

System.out.println("io error!");

catch (NumberFormatException e)

System.out.println("not a number!");

(7) int size = 100; //学生总数

(7)处应填()。

考点:计算机软件水平考试初级程序员初级程序员2010下半年下午试题
题型:填空题

在建设工程施工阶段,由于承包商自身的原因造成工期延误时,监理工程师对承包商修改后的进度计划的批准意味着( )。

A.同意延长施工合同工期

B.免除承包商的误期损失赔偿

C.确认承包商在合理的状态下施工

D.同意支付承包商赶工的全部额外开支

题型:填空题

试验方案就是根据()所拟订的进行比较的一组试验处理的总称

A、试验目的

B、试验要求

C、试验因素

D、试验方案

题型:填空题

试述顿咳恢复期气阴耗伤证的辨证施治。

题型:填空题

中 * * 关于全面推进依法治国若干重大问题的决定》提出,深入推进科学立法、民主立法,应健全法律法规规章起草征求()制度。

A.下级人大意见

B.人民意见

C.人大代表意见

D.上级人大意见

题型:填空题

下列双代号网络图中体现工作之间组织关系的工作是()

A.钢筋1和钢筋2

B.钢筋1和模板1

C.模板1和钢筋2

D.模板2和混凝土2

更多题库