本文共 1039 字,大约阅读时间需要 3 分钟。
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
/*
* B.java
*
* Created on 2007年4月18日, 下午7:58
*
*/
package edu.whu.idle.baidu;
/**
*
* @author idle~
*/
public class B {
private int num = 0; // 学生人数
private double maxScore = 0.0;
private double minScore = 0.0;
private double aveScore = 0.0;
private double tolScore = 0.0;
/** Creates a new instance of B */
public B(int num) {
this.num = num;
java.util.Scanner scanner = new java.util.Scanner(System.in);
System.out.println("please input " + num + " students' score");
maxScore = minScore = aveScore = scanner.nextDouble();
System.out.println("score of student 1 is" + maxScore);
for(int i = 0;i
double temp = scanner.nextDouble();
System.out.println("score of student " + (num+2) + "is" + temp);
tolScore += temp;
if(maxScore
maxScore = temp;
if(minScore > temp)
minScore = temp;
}
aveScore = tolScore / num;
System.out.println("max Score is " + maxScore);
System.out.println("min Score is " + minScore);
System.out.println("average score is " + aveScore);
}
public static void main(String[] args) {
new B(8);
}
}
转载地址:http://lodnv.baihongyu.com/