package com.task020202;
public class Student {
private int sNO;
private String sName;
private char sSex;
private int sAge;
private double sJava;
Student(int sNO, String sName, char sSex, int sAge, double sJava) {
this.sNO = sNO;
this.sName = sName;
this.sSex = sSex;
this.sAge = sAge;
this.sJava = sJava;
}
public int getsNO() {
return sNO;
}
public void setsNO(int sNO) {
this.sNO = sNO;
}
public String getsName() {
return sName;
}
public void setsName(String sName) {
this.sName = sName;
}
public char getsSex() {
return sSex;
}
public void setsSex(char sSex) {
this.sSex = sSex;
}
public int getsAge() {
return sAge;
}
public void setsAge(int sAge) {
this.sAge = sAge;
}
public double getsJava() {
return sJava;
}
public void setsJava(double sJava) {
this.sJava = sJava;
}
public static void main(String[] args) {
int arr1[] = { 2, 9, 48, 32, 65 };
String arr2[] = { "陈军", "何继", "夜华", "周红星", "刘佳怡" };
char arr3[] = { 'M', 'W', 'M', 'W', 'M' };
int arr4[] = { 22, 30, 60, 90, 80 };
double arr5[] = { 99.6, 88.6, 120.3, 88.9, 66.3 };
double sum = 0;
double max = 0,min = 0;
for (int i = 0; i < arr1.length; i++) {
Student in = new Student(arr1[i], arr2[i], arr3[i], arr4[i],arr5[i]);
System.out.println("学号 :" + in.sNO + " 姓名 :" + in.sName + " 性别 :"
+ in.sSex + " 年龄 :" + in.sAge + " Java成绩 :" + in.sJava);
sum += arr5[i];
}
max = arr5[0];
min = arr5[0];
for (int i = 0; i < arr5.length - 1; i++) {
if(max < arr5[i + 1]){
max = arr5[i + 1];
}if(min > arr5[i + 1]){
min = arr5[i + 1];
}
}
System.out.print("平均值=" + sum / 5 + " ");
System.out.print("最大值" + max + " ");
System.out.print("最小值" + min);
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)