14

package 灌灌灌灌;

public class StudentsBiz {

	String[] names = new String[30];
	private Object stub;

	public void addName(String name) {

	}

	public void showNames() {

	}

	public double calAvg(int[] scores) {
		int sum = 0;
		double avg = 0.0;
		for (int i = 0; i < scores.length; i++) {
			sum += scores[i];
		}
		avg = (double) sum / scores.length;
		return avg;
	}

	public int calMax(int[] scores) {
		int max = scores[0];
		for (int i = 0; i < scores.length; i++) {
			if (max < scores[i]) {
				max = scores[i];
			}
		}
		return max;
	}

	public void showNames1() { // TODO Auto-generated method stub

	}

	public void addName1(String newName) { // TODO Auto-generated method
	   stub
	   
	   }

	Student[] students = new Student[30];

	public void addStudent(Student stu) {
		for (int i = 0; i < students.length; i++) {
			if (students[i] != null) {
				students[i] = stu;
				break;
			}
		}
	}

	public void showStudents() {
		System.out.println("本班學生列表:");
		for (int i = 0; i < students.length; i++) {
			if (students[i] != null) {
				students[i].showInfo();
				break;
			}
		}
		System.out.println();
	}

	public void addName(String newName) {
		// TODO Auto-generated method stub

	}

	public void showNames() {
		// TODO Auto-generated method stub

	}
}

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36074157/article/details/52587521
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭