public class xx { String name; int number; double av; public xx(String x, int y) {
name = x; number = y;
} public void printData(){ System.out.print("name"+name+"\t"); System.out.println("number="+number);
} }
---------------------------------------------
public class aa { public static void prMax(xx a[]){ int nu=a[0].number; String Max; for(int i=1;i<a.length;i++) if(nu<a[i].number){ nu=a[i].number; Max=a[i].name; System.out.print("分數最高的學生為"+Max); }
public class hh { String name; int number; double av; public xx(String x, int y) {
name = x; number = y;
} public void printData(){ System.out.print("name"+name+"\t"); System.out.println("number="+number);
} }
---------------------------------------------
public class cc { public static void prMax(xx a[]){ int nu=a[0].number; String Max; for(int i=1;i<a.length;i++) if(nu<a[i].number){ nu=a[i].number; Max=a[i].name; System.out.print("分數最高的學生為"+Max); }
public class xx { String name; int number; double av; public xx(String x, int y) {
name = x; number = y;
} public void printData(){ System.out.print("name"+name+"\t"); System.out.println("number="+number);
} }
---------------------------------------------
public class aa { public static void prMax(xx a[]){ int nu=a[0].number; String Max; for(int i=1;i<a.length;i++) if(nu<a[i].number){ nu=a[i].number; Max=a[i].name; System.out.print("分數最高的學生為"+Max); }
public class student { String name; int level; public student(String x, int y) { name = x; level = y; } public void prData(){ System.out.println("name:"+name); System.out.println("level:"+level); } }
public class apple{ String name; int scroe; public apple(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ apple x[] = new apple[5]; x[0]= new apple("學生1", 60); x[1]= new apple("學生2", 87); x[2]= new apple("學生3", 47); x[3]= new apple("學生4", 50); x[4]= new apple("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class student{ String name; int scroe; public student(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ apple x[] = new apple[5]; x[0]= new student("學生1", 60); x[1]= new student("學生2", 87); x[2]= new student("學生3", 47); x[3]= new student("學生4", 50); x[4]= new student("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class student{ String name; int scroe; public student(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ apple x[] = new apple[5]; x[0]= new student("學生1", 60); x[1]= new student("學生2", 87); x[2]= new student("學生3", 47); x[3]= new student("學生4", 50); x[4]= new student("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public student(String x, int y){ name=x; score=y; }
public void printData(){ System.out.print("Name:"+name); System.out.print("\tScore"+score); } }
public class ss { public static void main(String[] args){ student X[]=new student[3]; X[0]=new student("學生1",60); X[1]=new student("學生2",87); X[2]=new student("學生3",47); X[3]=new student("學生4",50); X[4]=new student("學生5",66);
for (int i=0;i<X.length;i++) X[i].printData();
int a=0; for (int i=0 ; i<5; i++) a+=X[i].score; System.out.println("av="+a/5);
for (int i=0 ; i<5; i++) if(X[i].score<60) System.out.println("不及格="+X[i].name); int c = 0 ; for(int b=0 ; b<5; b++){ if (X[b].score >c) c = X[b].score; }System.out.println("最高分="+c);
public class student{ String name; int scroe; public student(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ apple x[] = new apple[5]; x[0]= new student("學生1", 60); x[1]= new student("學生2", 87); x[2]= new student("學生3", 47); x[3]= new student("學生4", 50); x[4]= new student("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class test{ String name; int scroe; public test(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ test x[] = new apple[5]; x[0]= new test("學生1", 60); x[1]= new test("學生2", 87); x[2]= new test("學生3", 47); x[3]= new test("學生4", 50); x[4]= new test("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class xx { String name; int number; double av; public xx(String x, int y) {
name = x; number = y;
} public void printData(){ System.out.print("name"+name+"\t"); System.out.println("number="+number);
} }
---------------------------------------------
public class aa { public static void prMax(xx a[]){ int nu=a[0].number; String Max; for(int i=1;i<a.length;i++) if(nu<a[i].number){ nu=a[i].number; Max=a[i].name; System.out.print("分數最高的學生為"+Max); }
public class app{ String name; int scroe; public app(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ app x[] = new apple[5]; x[0]= new app("學生1", 60); x[1]= new app("學生2", 87); x[2]= new app("學生3", 47); x[3]= new app("學生4", 50); x[4]= new app("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class xx { String name; int number; double av; public xx(String x, int y) {
name = x; number = y;
} public void printData(){ System.out.print("name"+name+"\t"); System.out.println("number="+number);
} }
---------------------------------------------
public class aa { public static void prMax(xx a[]){ int nu=a[0].number; String Max; for(int i=1;i<a.length;i++) if(nu<a[i].number){ nu=a[i].number; Max=a[i].name; System.out.print("分數最高的學生為"+Max); }
public class student{ String name; int scroe; public student(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ apple x[] = new apple[5]; x[0]= new student("學生1", 60); x[1]= new student("學生2", 87); x[2]= new student("學生3", 47); x[3]= new student("學生4", 50); x[4]= new student("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class tostudent{ String name; int scroe; public student(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ apple x[] = new apple[5]; x[0]= new student("學生1", 60); x[1]= new student("學生2", 87); x[2]= new student("學生3", 47); x[3]= new student("學生4", 50); x[4]= new student("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class student{ String name; int scroe; public student(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ apple x[] = new apple[5]; x[0]= new student("學生1", 60); x[1]= new student("學生2", 87); x[2]= new student("學生3", 47); x[3]= new student("學生4", 50); x[4]= new student("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class student { String name; int level; public student(String x, int y) { name = x; level = y; } public void prData(){ System.out.println("name:"+name); System.out.println("level:"+level); } }
public class student{ String name; int scroe; public student(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ apple x[] = new apple[5]; x[0]= new student("學生1", 60); x[1]= new student("學生2", 87); x[2]= new student("學生3", 47); x[3]= new student("學生4", 50); x[4]= new student("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class student{ String name; int scroe; public student(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ apple x[] = new apple[5]; x[0]= new student("學生1", 60); x[1]= new student("學生2", 87); x[2]= new student("學生3", 47); x[3]= new student("學生4", 50); x[4]= new student("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class student{ String name; int scroe; public student(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ apple x[] = new apple[5]; x[0]= new student("學生1", 60); x[1]= new student("學生2", 87); x[2]= new student("學生3", 47); x[3]= new student("學生4", 50); x[4]= new student("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class student { String name; int level; public student(String x, int y) { name = x; level = y; } public void prData(){ System.out.println("name:"+name); System.out.println("level:"+level); } }
public class student1 { public static void prMax(student x[]){ student Max=x[0]; for(int i=0; iMax.level) Max=x[i]; System.out.println(Max.name); } public static void main(String[] args) { student x[]=new student[5]; x[0]=new student("學生1",60); x[1]=new student("學生2",87) ; x[2]=new student("學生3",47); x[3]=new student("學生4",50); x[4]=new student("學生5",66); prMax(x); }
public class xx { String name; int number; double av; public xx(String x, int y) {
name = x; number = y;
} public void printData(){ System.out.print("name"+name+"\t"); System.out.println("number="+number);
} }
---------------------------------------------
public class aa { public static void prMax(xx a[]){ int nu=a[0].number; String Max; for(int i=1;i<a.length;i++) if(nu<a[i].number){ nu=a[i].number; Max=a[i].name; System.out.print("分數最高的學生為"+Max); }
public class test{ String name; int scroe; public test(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ test x[] = new test[5]; x[0]= new test("學生1", 60); x[1]= new test("學生2", 87); x[2]= new test("學生3", 47); x[3]= new test("學生4", 50); x[4]= new test("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public student(String x, int y) { name = x; score = y; }
public static void main(String[] args) { student[] x = new student[5]; x[0] = new student("學生一", 60); x[1] = new student("學生二", 87); x[2] = new student("學生三", 47); x[3] = new student("學生四", 50); x[4] = new student("學生五", 66); for (int i = 1; i < x.length; i++) if (x[i].score > x[0].score) x[0] = x[i]; System.out.print(x[0].name); } }
public class student{ String name; int scroe; public student(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ apple x[] = new apple[5]; x[0]= new student("學生1", 60); x[1]= new student("學生2", 87); x[2]= new student("學生3", 47); x[3]= new student("學生4", 50); x[4]= new student("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class student{ String name; int scroe; public student(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ apple x[] = new apple[5]; x[0]= new student("學生1", 60); x[1]= new student("學生2", 87); x[2]= new student("學生3", 47); x[3]= new student("學生4", 50); x[4]= new student("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class student{ String name; int scroe; public student(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ apple x[] = new apple[5]; x[0]= new student("學生1", 60); x[1]= new student("學生2", 87); x[2]= new student("學生3", 47); x[3]= new student("學生4", 50); x[4]= new student("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class student{ String name; int scroe; public student(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ apple x[] = new apple[5]; x[0]= new student("學生1", 60); x[1]= new student("學生2", 87); x[2]= new student("學生3", 47); x[3]= new student("學生4", 50); x[4]= new student("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
public class test{ String name; int scroe; public test(String name,int scroe){ this.name = name; this.scroe = scroe; } public static void main(String[]args){ test x[] = new test[5]; x[0]= new test("學生1", 60); x[1]= new test("學生2", 87); x[2]= new test("學生3", 47); x[3]= new test("學生4", 50); x[4]= new test("學生5", 66); int a =0; int b = 0; for(int i=0; i<x.length; i++){ b+= x[i].scroe; if(a<x[i].scroe){ a= x[i].scroe; } }
53 則留言:
public class student {
String name ;
int score;
public student (String x, int y){
name = x;
score = y;
}
public void printData(){
System.out.print("name:"+name);
System.out.println("\tscore:"+score);
}
}
public class ex1 {
public static void main(String[] args) {
student[] X = new student[5];
X[0]= new student ("學生1", 60);
X[1]= new student ("學生2", 87);
X[2]= new student ("學生3", 47);
X[3]= new student ("學生4", 50);
X[4]= new student ("學生5", 66);
for(int i=0; i<X.length; i++)
X[i].printData();
int a =0;
for(int i=0 ; i<5; i++)
a+=X[i].score;
System.out.println("av="+a/5);
for(int i=0 ; i<5; i++)
if(X[i].score<60)
System.out.println("不及格="+X[i].name);
int c = 0 ;
for(int b=0 ; b<5; b++){
if (X[b].score >c)
c = X[b].score;
}System.out.println("最高分="+c);
}
}
public class student1 {
String name;
int score;
public student1(String name, int score) {
super();
this.name = name;
this.score = score;
}
public void printData(){
System.out.print("name:"+name);
System.out.println("\tscore:"+score);
}
}
public class student2 {
public static double average(student1[]x){
double f=0;
for (int i=0; i<x.length;i++)
f+=(double)x[i].score;
return f/x.length;
}
public static void main(String[] args) {
student1 []x=new student1[5];
x[0]=new student1("學生1",60);
x[1]=new student1("學生2",87);
x[2]=new student1("學生3",47);
x[3]=new student1("學生4",50);
x[4]=new student1("學生5",66);
for (int i=0;i<x.length;i++)
x[i].printData();
System.out.println("average="+average(x));
}
}
public class student {
String name;
int score;
public student(String name, int score) {
this.name = name;
this.score = score;
}
public void printDate(){
System.out.print("name:"+name);
System.out.println("\tscore:"+score);
}
}
public class stdEx {
public static double average(student[]x){
double f=0;
for(int i=0;i<x.length;i++)
f+=(double)x[i].score;
return f/x.length;
}
public static void main(String[] args){
student x[]=new student[5];
x[0]=new student("學生1",60);
x[1]=new student("學生2",87);
x[2]=new student("學生3",47);
x[3]=new student("學生4",50);
x[4]=new student("學生5",66);
for (int i=0;i<x.length;i++)
x[i].printDate();
System.out.println("average="+average(x));
}
}
public class stdEX {
public static void main(String[] args) {
student x[]=new student[5];
x[0]=new student("學生1",60);
x[1]=new student("學生2",87);
x[2]=new student("學生3",47);
x[3]=new student("學生4",50);
x[4]=new student("學生5",66);
student max=x[0];
for(int j=0;j<x.length;j++){
if (x[j].score>max.score)
max=x[j];
}System.out.println("最高分:"+max.name);
int sum=0;
for(int j=0;j<x.length;j++){
sum+=x[j].score;
}System.out.println("平均="+sum/x.length);
for(int k=0;k<x.length;k++){
if (x[k].score<60.0){
System.out.print("不及格者:");
x[k].printdata();
}
}
}
}
public class xx {
String name;
int number;
double av;
public xx(String x, int y) {
name = x;
number = y;
}
public void printData(){
System.out.print("name"+name+"\t");
System.out.println("number="+number);
}
}
---------------------------------------------
public class aa {
public static void prMax(xx a[]){
int nu=a[0].number;
String Max;
for(int i=1;i<a.length;i++)
if(nu<a[i].number){
nu=a[i].number;
Max=a[i].name;
System.out.print("分數最高的學生為"+Max);
}
}
public static void main(String[] args){
double av=0;
xx a[]=new xx[5];
a[0]=new xx("學生1", 60);
a[1]=new xx("學生2", 87);
a[2]=new xx("學生3", 47);
a[3]=new xx("學生4", 50);
a[4]=new xx("學生5", 66);
for(int i=0;i<a.length;i++){
a[i].printData();
av+=a[i].number;
} prMax(a);
}
}
public class xx { String name; int number; double av; public xx(String x, int y) { name = x; number = y; } public void printData(){ System.out.print("name"+name+"\t"); System.out.println("number="+number); }}---------------------------------------------public class aa { public static void prMax(xx a[]){ int nu=a[0].number; String Max; for(int i=1;i<a.length;i++) if(nu<a[i].number){ nu=a[i].number; Max=a[i].name; System.out.print("分數最高的學生為"+Max); } } public static void main(String[] args){ double av=0; xx a[]=new xx[5]; a[0]=new xx("學生1", 60); a[1]=new xx("學生2", 87); a[2]=new xx("學生3", 47); a[3]=new xx("學生4", 50); a[4]=new xx("學生5", 66); for(int i=0;i<a.length;i++){ a[i].printData(); av+=a[i].number; } prMax(a); }}.
public class hh {
String name;
int number;
double av;
public xx(String x, int y) {
name = x;
number = y;
}
public void printData(){
System.out.print("name"+name+"\t");
System.out.println("number="+number);
}
}
---------------------------------------------
public class cc {
public static void prMax(xx a[]){
int nu=a[0].number;
String Max;
for(int i=1;i<a.length;i++)
if(nu<a[i].number){
nu=a[i].number;
Max=a[i].name;
System.out.print("分數最高的學生為"+Max);
}
}
public static void main(String[] args){
double av=0;
xx a[]=new xx[5];
a[0]=new xx("學生1", 60);
a[1]=new xx("學生2", 87);
a[2]=new xx("學生3", 47);
a[3]=new xx("學生4", 50);
a[4]=new xx("學生5", 66);
for(int i=0;i<a.length;i++){
a[i].printData();
av+=a[i].number;
} prMax(a);
}
}
public class xx {
String name;
int number;
double av;
public xx(String x, int y) {
name = x;
number = y;
}
public void printData(){
System.out.print("name"+name+"\t");
System.out.println("number="+number);
}
}
---------------------------------------------
public class aa {
public static void prMax(xx a[]){
int nu=a[0].number;
String Max;
for(int i=1;i<a.length;i++)
if(nu<a[i].number){
nu=a[i].number;
Max=a[i].name;
System.out.print("分數最高的學生為"+Max);
}
}
public static void main(String[] args){
double av=0;
xx a[]=new xx[5];
a[0]=new xx("學生1", 60);
a[1]=new xx("學生2", 87);
a[2]=new xx("學生3", 47);
a[3]=new xx("學生4", 50);
a[4]=new xx("學生5", 66);
for(int i=0;i<a.length;i++){
a[i].printData();
av+=a[i].number;
} prMax(a);
}
}
public class student {
String name;
int level;
public student(String x, int y) {
name = x;
level = y;
}
public void prData(){
System.out.println("name:"+name);
System.out.println("level:"+level);
}
}
public class student1 {
public static void prMax(student x[]){
student Max=x[0];
for(int i=0; i<x.length; i++)
if(x[i].level>Max.level)
Max=x[i];
System.out.println(Max.name);
}
public static void main(String[] args) {
student x[]=new student[5];
x[0]=new student("學生1",60);
x[1]=new student("學生2",87) ;
x[2]=new student("學生3",47);
x[3]=new student("學生4",50);
x[4]=new student("學生5",66);
prMax(x);
}
}
public class apple{
String name;
int scroe;
public apple(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
apple x[] = new apple[5];
x[0]= new apple("學生1", 60);
x[1]= new apple("學生2", 87);
x[2]= new apple("學生3", 47);
x[3]= new apple("學生4", 50);
x[4]= new apple("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int m=0; m<x.length; m++){
if(a==x[m].scroe){
System.out.println("最高分姓名:"+x[m].name);
System.out.println("最高分:"+a);
}
}
System.out.println("平均:"+b/x.length);
for(int n=0; n<x.length; n++)
if(x[n].scroe<60){
System.out.println("不及格姓名:"+x[n].name);
System.out.println("不及格分數:"+x[n].scroe);
}
}
}
public class student{
String name;
int scroe;
public student(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
apple x[] = new apple[5];
x[0]= new student("學生1", 60);
x[1]= new student("學生2", 87);
x[2]= new student("學生3", 47);
x[3]= new student("學生4", 50);
x[4]= new student("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int m=0; m<x.length; m++){
if(a==x[m].scroe){
System.out.println("最高分:"+x[m].name);
}
}
System.out.println("平均:"+b/x.length);
for(int n=0; n<x.length; n++)
if(x[n].scroe<60){
System.out.println("不及格姓名:"+x[n].name);
System.out.println("不及格分數:"+x[n].scroe);
}
}
}
public class student{
String name;
int scroe;
public student(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
apple x[] = new apple[5];
x[0]= new student("學生1", 60);
x[1]= new student("學生2", 87);
x[2]= new student("學生3", 47);
x[3]= new student("學生4", 50);
x[4]= new student("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int o=0; o<x.length; o++){
if(a==x[o].scroe){
System.out.println("最高分:"+x[o].name);
}
}
System.out.println("平均:"+b/x.length);
for(int p=0; p<x.length; p++)
if(x[p].scroe<60){
System.out.println("不及格姓名:"+x[p].name);
System.out.println("不及格分數:"+x[p].scroe);
}
}
}
public class aaaaa {
String name;
int score;
public aaaaa(String name, int score) {
super();
this.name = name;
this.score = score;
}
public void printData(){
System.out.print("name:"+name);
System.out.println("\tscore:"+score);
}
}
---------------------------
public class bbbbb {
public static double average(student1[]x){
double f=0;
for (int i=0; i<x.length;i++)
f+=(double)x[i].score;
return f/x.length;
}
public static void main(String[] args) {
student1 []x=new student1[5];
x[0]=new student1("學生1",60);
x[1]=new student1("學生2",87);
x[2]=new student1("學生3",47);
x[3]=new student1("學生4",50);
x[4]=new student1("學生5",66);
for (int i=0;i<x.length;i++)
x[i].printData();
System.out.println("average="+average(x));
}
}
class sor2{
public static void prmm(sor x[]){
sor Max=x[0];
for(int i=0;i<x.length;i++){
if(Max.jj<x[i].jj)
Max=x[i];
}
System.out.println(Max.kk);
}
public static void prav(sor x[]){
int av=0;
for(int i=0;i<x.length;i++){
av+=x[i].jj;
}
System.out.println((double)av/x.length);
}
public static void prlk(sor x[]){
for(int i=0;i<x.length;i++){
if(60>x[i].jj)
System.out.print(x[i].kk+"\t"+x[i].jj+"\n");
}
}
public static void main(String[]args){
sor x[]=new sor[5];
x[0]=new sor("學生1",60);
x[1]=new sor("學生2",87);
x[2]=new sor("學生3",47);
x[3]=new sor("學生4",50);
x[4]=new sor("學生5",66);
prmm(x);
prav(x);
prlk(x);
}
}
public class student {
String name;
int score;
public student(String x, int y){
name=x;
score=y;
}
public void printData(){
System.out.print("Name:"+name);
System.out.print("\tScore"+score);
}
}
public class ss {
public static void main(String[] args){
student X[]=new student[3];
X[0]=new student("學生1",60);
X[1]=new student("學生2",87);
X[2]=new student("學生3",47);
X[3]=new student("學生4",50);
X[4]=new student("學生5",66);
for (int i=0;i<X.length;i++)
X[i].printData();
int a=0;
for (int i=0 ; i<5; i++)
a+=X[i].score;
System.out.println("av="+a/5);
for (int i=0 ; i<5; i++)
if(X[i].score<60)
System.out.println("不及格="+X[i].name);
int c = 0 ;
for(int b=0 ; b<5; b++){
if (X[b].score >c)
c = X[b].score;
}System.out.println("最高分="+c);
}
}
public class student1 {
public static void av(student x[]){
double av=0;
for(int i=0;i<x.length;i++){
av+=x[i].level;
}
System.out.println(av/5);
}
public static void main(String[] args) {
student x[]=new student[5];
x[0]=new student("學生1",60);
x[1]=new student("學生2",87);
x[2]=new student("學生3",47);
x[3]=new student("學生4",50);
x[4]=new student("學生5",66);
av(x);
}
}
public class student1 {
public static void av(student x[]){
double av=0;
for(int i=0;i<x.length;i++){
if(60<x[i].level)
System.out.println(x[i].name+"\t"+x[i].level+"\n");
}
}
public static void main(String[] args) {
student x[]=new student[5];
x[0]=new student("學生1",60);
x[1]=new student("學生2",87);
x[2]=new student("學生3",47);
x[3]=new student("學生4",50);
x[4]=new student("學生5",66);
av(x);
}
}
public class student{
String name;
int scroe;
public student(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
apple x[] = new apple[5];
x[0]= new student("學生1", 60);
x[1]= new student("學生2", 87);
x[2]= new student("學生3", 47);
x[3]= new student("學生4", 50);
x[4]= new student("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int o=0; o<x.length; o++){
if(a==x[o].scroe){
System.out.println("最高分:"+x[o].name);
}
}
System.out.println("平均:"+b/x.length);
for(int p=0; p<x.length; p++)
if(x[p].scroe<60){
System.out.println("不及格姓名:"+x[p].name);
System.out.println("不及格分數:"+x[p].scroe);
}
}
}
public class one {
public static void main(String[] args) {
student[] X = new student[5];
X[0]= new student ("學生1", 60);
X[1]= new student ("學生2", 87);
X[2]= new student ("學生3", 47);
X[3]= new student ("學生4", 50);
X[4]= new student ("學生5", 66);
for(int i=0; i<X.length; i++)
X[i].printData();
int a =0;
for(int i=0 ; i<5; i++)
a+=X[i].score;
System.out.println("av="+a/5);
for(int i=0 ; i<5; i++)
if(X[i].score<60)
System.out.println("不及格="+X[i].name);
int c = 0 ;
for(int b=0 ; b<5; b++){
if (X[b].score >c)
c = X[b].score;
}System.out.println("最高分="+c);
}
}
public class test{
String name;
int scroe;
public test(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
test x[] = new apple[5];
x[0]= new test("學生1", 60);
x[1]= new test("學生2", 87);
x[2]= new test("學生3", 47);
x[3]= new test("學生4", 50);
x[4]= new test("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int m=0; m<x.length; m++){
if(a==x[m].scroe){
System.out.println("最高分姓名:"+x[m].name);
System.out.println("最高分:"+a);
}
}
System.out.println("平均:"+b/x.length);
for(int n=0; n<x.length; n++)
if(x[n].scroe<60){
System.out.println("不及格姓名:"+x[n].name);
System.out.println("不及格分數:"+x[n].scroe);
}
}
}
public class xx {
String name;
int number;
double av;
public xx(String x, int y) {
name = x;
number = y;
}
public void printData(){
System.out.print("name"+name+"\t");
System.out.println("number="+number);
}
}
---------------------------------------------
public class aa {
public static void prMax(xx a[]){
int nu=a[0].number;
String Max;
for(int i=1;i<a.length;i++)
if(nu<a[i].number){
nu=a[i].number;
Max=a[i].name;
System.out.print("分數最高的學生為"+Max);
}
}
public static void main(String[] args){
double av=0;
xx a[]=new xx[5];
a[0]=new xx("學生1", 60);
a[1]=new xx("學生2", 87);
a[2]=new xx("學生3", 47);
a[3]=new xx("學生4", 50);
a[4]=new xx("學生5", 66);
for(int i=0;i<a.length;i++){
a[i].printData();
av+=a[i].number;
} prMax(a);
}
}
public class app{
String name;
int scroe;
public app(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
app x[] = new apple[5];
x[0]= new app("學生1", 60);
x[1]= new app("學生2", 87);
x[2]= new app("學生3", 47);
x[3]= new app("學生4", 50);
x[4]= new app("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int m=0; m<x.length; m++){
if(a==x[m].scroe){
System.out.println("最高分姓名:"+x[m].name);
System.out.println("最高分:"+a);
}
}
System.out.println("平均:"+b/x.length);
for(int n=0; n<x.length; n++)
if(x[n].scroe<60){
System.out.println("不及格姓名:"+x[n].name);
System.out.println("不及格分數:"+x[n].scroe);
}
}
}
public class xx {
String name;
int number;
double av;
public xx(String x, int y) {
name = x;
number = y;
}
public void printData(){
System.out.print("name"+name+"\t");
System.out.println("number="+number);
}
}
---------------------------------------------
public class aa {
public static void prMax(xx a[]){
int nu=a[0].number;
String Max;
for(int i=1;i<a.length;i++)
if(nu<a[i].number){
nu=a[i].number;
Max=a[i].name;
System.out.print("分數最高的學生為"+Max);
}
}
public static void main(String[] args){
double av=0;
xx a[]=new xx[5];
a[0]=new xx("學生1", 60);
a[1]=new xx("學生2", 87);
a[2]=new xx("學生3", 47);
a[3]=new xx("學生4", 50);
a[4]=new xx("學生5", 66);
for(int i=0;i<a.length;i++){
a[i].printData();
av+=a[i].number;
} prMax(a);
}
}
public class student{
String name;
int scroe;
public student(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
apple x[] = new apple[5];
x[0]= new student("學生1", 60);
x[1]= new student("學生2", 87);
x[2]= new student("學生3", 47);
x[3]= new student("學生4", 50);
x[4]= new student("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int m=0; m<x.length; m++){
if(a==x[m].scroe){
System.out.println("最高分:"+x[m].name);
}
}
System.out.println("平均:"+b/x.length);
for(int n=0; n<x.length; n++)
if(x[n].scroe<60){
System.out.println("不及格姓名:"+x[n].name);
System.out.println("不及格分數:"+x[n].scroe);
}
}
}
public class tostudent{
String name;
int scroe;
public student(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
apple x[] = new apple[5];
x[0]= new student("學生1", 60);
x[1]= new student("學生2", 87);
x[2]= new student("學生3", 47);
x[3]= new student("學生4", 50);
x[4]= new student("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int o=0; o<x.length; o++){
if(a==x[o].scroe){
System.out.println("最高分:"+x[o].name);
}
}
System.out.println("平均:"+b/x.length);
for(int p=0; p<x.length; p++)
if(x[p].scroe<60){
System.out.println("不及格的姓名:"+x[p].name);
System.out.println("不及格的分數:"+x[p].scroe);
}
}
}
public class student{
String name;
int scroe;
public student(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
apple x[] = new apple[5];
x[0]= new student("學生1", 60);
x[1]= new student("學生2", 87);
x[2]= new student("學生3", 47);
x[3]= new student("學生4", 50);
x[4]= new student("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int m=0; m<x.length; m++){
if(a==x[m].scroe){
System.out.println("最高分:"+x[m].name);
}
}
System.out.println("平均:"+b/x.length);
for(int n=0; n<x.length; n++)
if(x[n].scroe<60){
System.out.println("不及格姓名:"+x[n].name);
System.out.println("不及格分數:"+x[n].scroe);
}
}
}
public class student {
String name;
int score;
public student(String name, int score) {
this.name = name;
this.score = score;
}
public void printDate(){
System.out.print("name:"+name);
System.out.println("\tscore:"+score);
}
}
public class stdEx {
public static double average(student[]x){
double f=0;
for(int i=0;i<x.length;i++)
f+=(double)x[i].score;
return f/x.length;
}
public static void main(String[] args){
student x[]=new student[5];
x[0]=new student("學生1",60);
x[1]=new student("學生2",87);
x[2]=new student("學生3",47);
x[3]=new student("學生4",50);
x[4]=new student("學生5",66);
for (int i=0;i<x.length;i++)
x[i].printDate();
System.out.println("average="+average(x));
}
}
public class student {
String name;
int level;
public student(String x, int y) {
name = x;
level = y;
}
public void prData(){
System.out.println("name:"+name);
System.out.println("level:"+level);
}
}
public class student1 {
public static void prMax(student x[]){
student Max=x[0];
for(int i=0; i<x.length; i++)
if(x[i].level>Max.level)
Max=x[i];
System.out.println(Max.name);
}
public static void main(String[] args) {
student x[]=new student[5];
x[0]=new student("學生1",60);
x[1]=new student("學生2",87) ;
x[2]=new student("學生3",47);
x[3]=new student("學生4",50);
x[4]=new student("學生5",66);
prMax(x);
}
}
public class student{
String name;
int scroe;
public student(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
apple x[] = new apple[5];
x[0]= new student("學生1", 60);
x[1]= new student("學生2", 87);
x[2]= new student("學生3", 47);
x[3]= new student("學生4", 50);
x[4]= new student("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int o=0; o<x.length; o++){
if(a==x[o].scroe){
System.out.println("最高分:"+x[o].name);
}
}
System.out.println("平均:"+b/x.length);
for(int p=0; p<x.length; p++)
if(x[p].scroe<60){
System.out.println("不及格姓名:"+x[p].name);
System.out.println("不及格分數:"+x[p].scroe);
}
}
}
public class student{
String name;
int scroe;
public student(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
apple x[] = new apple[5];
x[0]= new student("學生1", 60);
x[1]= new student("學生2", 87);
x[2]= new student("學生3", 47);
x[3]= new student("學生4", 50);
x[4]= new student("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int m=0; m<x.length; m++){
if(a==x[m].scroe){
System.out.println("最高分:"+x[m].name);
}
}
System.out.println("平均:"+b/x.length);
for(int n=0; n<x.length; n++)
if(x[n].scroe<60){
System.out.println("不及格姓名:"+x[n].name);
System.out.println("不及格分數:"+x[n].scroe);
}
}
}
public class student{
String name;
int scroe;
public student(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
apple x[] = new apple[5];
x[0]= new student("學生1", 60);
x[1]= new student("學生2", 87);
x[2]= new student("學生3", 47);
x[3]= new student("學生4", 50);
x[4]= new student("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int o=0; o<x.length; o++){
if(a==x[o].scroe){
System.out.println("最高分:"+x[o].name);
}
}
System.out.println("平均:"+b/x.length);
for(int p=0; p<x.length; p++)
if(x[p].scroe<60){
System.out.println("不及格姓名:"+x[p].name);
System.out.println("不及格分數:"+x[p].scroe);
}
}
}
public class student {
String name;
int level;
public student(String x, int y) {
name = x;
level = y;
}
public void prData(){
System.out.println("name:"+name);
System.out.println("level:"+level);
}
}
public class student1 {
public static void prMax(student x[]){
student Max=x[0];
for(int i=0; iMax.level)
Max=x[i];
System.out.println(Max.name);
}
public static void main(String[] args) {
student x[]=new student[5];
x[0]=new student("學生1",60);
x[1]=new student("學生2",87) ;
x[2]=new student("學生3",47);
x[3]=new student("學生4",50);
x[4]=new student("學生5",66);
prMax(x);
}
}
public class student1 {
String name;
int score;
public student1(String name, int score) {
super();
this.name = name;
this.score = score;
}
public void printData(){
System.out.print("name:"+name);
System.out.println("\tscore:"+score);
}
}
public class student2 {
public static double average(student1[]x){
double f=0;
for (int i=0; i<x.length;i++)
f+=(double)x[i].score;
return f/x.length;
}
public static void main(String[] args) {
student1 []x=new student1[5];
x[0]=new student1("學生1",60);
x[1]=new student1("學生2",87);
x[2]=new student1("學生3",47);
x[3]=new student1("學生4",50);
x[4]=new student1("學生5",66);
for (int i=0;i<x.length;i++)
x[i].printData();
System.out.println("average="+average(x));
}
}
public class xx {
String name;
int number;
double av;
public xx(String x, int y) {
name = x;
number = y;
}
public void printData(){
System.out.print("name"+name+"\t");
System.out.println("number="+number);
}
}
---------------------------------------------
public class aa {
public static void prMax(xx a[]){
int nu=a[0].number;
String Max;
for(int i=1;i<a.length;i++)
if(nu<a[i].number){
nu=a[i].number;
Max=a[i].name;
System.out.print("分數最高的學生為"+Max);
}
}
public static void main(String[] args){
double av=0;
xx a[]=new xx[5];
a[0]=new xx("學生1", 60);
a[1]=new xx("學生2", 87);
a[2]=new xx("學生3", 47);
a[3]=new xx("學生4", 50);
a[4]=new xx("學生5", 66);
for(int i=0;i<a.length;i++){
a[i].printData();
av+=a[i].number;
} prMax(a);
}
}
public class stdEX {
public static void main(String[] args) {
student x[]=new student[5];
x[0]=new student("學生1",60);
x[1]=new student("學生2",87);
x[2]=new student("學生3",47);
x[3]=new student("學生4",50);
x[4]=new student("學生5",66);
student max=x[0];
for(int j=0;j<x.length;j++){
if (x[j].score>max.score)
max=x[j];
}System.out.println("最高分:"+max.name);
int sum=0;
for(int j=0;j<x.length;j++){
sum+=x[j].score;
}System.out.println("平均="+sum/x.length);
}
}
public class student {
String name ;
int score;
public student (String x, int y){
name = x;
score = y;
}
public void printData(){
System.out.print("name:"+name);
System.out.println("\tscore:"+score);
}
}
public class ex1 {
public static void main(String[] args) {
student[] X = new student[5];
X[0]= new student ("學生1", 60);
X[1]= new student ("學生2", 87);
X[2]= new student ("學生3", 47);
X[3]= new student ("學生4", 50);
X[4]= new student ("學生5", 66);
for(int i=0; i<X.length; i++)
X[i].printData();
int a =0;
for(int i=0 ; i<5; i++)
a+=X[i].score;
System.out.println("av="+a/5);
for(int i=0 ; i<5; i++)
if(X[i].score<60)
System.out.println("不及格="+X[i].name);
int c = 0 ;
for(int b=0 ; b<5; b++){
if (X[b].score >c)
c = X[b].score;
}System.out.println("最高分="+c);
}
}
public class student {
String name ;
int score;
public student (String x, int y){
name = x;
score = y;
}
public void printData(){
System.out.print("name:"+name);
System.out.println("\tscore:"+score);
}
}
public class ex1 {
public class student {
String name;
int score;
public student(String x, int y){
name=x;
score=y;
}
public void printData(){
System.out.print("Name:"+name);
System.out.print("\tScore"+score);
}
}
public class student {
String name ;
int score;
public student (String x, int y){
name = x;
score = y;
}
public void printData(){
System.out.print("name:"+name);
System.out.println("\tscore:"+score);
}
}
public class ex1 {
public class stdEX {
public static void main(String[] args) {
student x[]=new student[5];
x[0]=new student("學生1",60);
x[1]=new student("學生2",87);
x[2]=new student("學生3",47);
x[3]=new student("學生4",50);
x[4]=new student("學生5",66);
student max=x[0];
for(int j=0;jmax.score)
max=x[j];
}System.out.println("最高分:"+max.name);
int sum=0;
for(int j=0;j<x.length;j++){
sum+=x[j].score;
}System.out.println("平均="+sum/x.length);
}
}
public class hello {
public static void main(String[] args) {
student x[]=new student[5];
x[0]=new student("學生1",60);
x[1]=new student("學生2",87);
x[2]=new student("學生3",47);
x[3]=new student("學生4",50);
x[4]=new student("學生5",66);
student max=x[0];
for(int j=0;jmax.score)
max=x[j];
}System.out.println("最高分:"+max.name);
int sum=0;
for(int j=0;j<x.length;j++){
sum+=x[j].score;
}System.out.println("平均="+sum/x.length);
for(int k=0;k<x.length;k++){
if (x[k].score<60.0){
System.out.print("不及格者:");
x[k].printdata();
}
}
}
}
public class test{
String name;
int scroe;
public test(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
test x[] = new test[5];
x[0]= new test("學生1", 60);
x[1]= new test("學生2", 87);
x[2]= new test("學生3", 47);
x[3]= new test("學生4", 50);
x[4]= new test("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int m=0; m<x.length; m++){
if(a==x[m].scroe){
System.out.println("最高分姓名:"+x[m].name);
System.out.println("最高分:"+a);
}
}
System.out.println("平均:"+b/x.length);
for(int n=0; n<x.length; n++)
if(x[n].scroe<60){
System.out.println("不及格姓名:"+x[n].name);
System.out.println("不及格分數:"+x[n].scroe);
}
}
}
public class stdEX {
public static void main(String[] args) {
student x[]=new student[5];
x[0]=new student("學生1",60);
x[1]=new student("學生2",87);
x[2]=new student("學生3",47);
x[3]=new student("學生4",50);
x[4]=new student("學生5",66);
student max=x[0];
for(int i=0;i<x.length;i++){
if (x[i].score>max.score)
max=x[i];
}System.out.println("最高分:"+max.name);
int sum=0;
for(int i=0;i<x.length;i++){
sum+=x[i].score;
}System.out.println("平均="+sum/x.length);
for(int i=0;i<x.length;i++){
if (x[i].score<60.0){
System.out.print("不及格者:");
x[i].printdata();
}
}
}
}
public class student {
String name;
int score;
public student(String x, int y) {
name = x;
score = y;
}
public static void main(String[] args) {
student[] x = new student[5];
x[0] = new student("學生一", 60);
x[1] = new student("學生二", 87);
x[2] = new student("學生三", 47);
x[3] = new student("學生四", 50);
x[4] = new student("學生五", 66);
for (int i = 1; i < x.length; i++)
if (x[i].score > x[0].score)
x[0] = x[i];
System.out.print(x[0].name);
}
}
public class student{
String name;
int scroe;
public student(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
apple x[] = new apple[5];
x[0]= new student("學生1", 60);
x[1]= new student("學生2", 87);
x[2]= new student("學生3", 47);
x[3]= new student("學生4", 50);
x[4]= new student("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int m=0; m<x.length; m++){
if(a==x[m].scroe){
System.out.println("最高分:"+x[m].name);
}
}
System.out.println("平均:"+b/x.length);
for(int n=0; n<x.length; n++)
if(x[n].scroe<60){
System.out.println("不及格:"+x[n].name);
}
}
}
public class student{
String name;
int scroe;
public student(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
apple x[] = new apple[5];
x[0]= new student("學生1", 60);
x[1]= new student("學生2", 87);
x[2]= new student("學生3", 47);
x[3]= new student("學生4", 50);
x[4]= new student("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int m=0; m<x.length; m++){
if(a==x[m].scroe){
System.out.println("最高分:"+x[m].name);
}
}
System.out.println("平均:"+b/x.length);
for(int n=0; n<x.length; n++)
if(x[n].scroe<60){
System.out.println("不及格:"+x[n].name);
}
}
}
public class student{
String name;
int scroe;
public student(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
apple x[] = new apple[5];
x[0]= new student("學生1", 60);
x[1]= new student("學生2", 87);
x[2]= new student("學生3", 47);
x[3]= new student("學生4", 50);
x[4]= new student("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int m=0; m<x.length; m++){
if(a==x[m].scroe){
System.out.println("最高分:"+x[m].name);
}
}
System.out.println("平均:"+b/x.length);
for(int n=0; n<x.length; n++)
if(x[n].scroe<60){
System.out.println("不及格:"+x[n].name);
}
}
}
public class student{
String name;
int scroe;
public student(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
apple x[] = new apple[5];
x[0]= new student("學生1", 60);
x[1]= new student("學生2", 87);
x[2]= new student("學生3", 47);
x[3]= new student("學生4", 50);
x[4]= new student("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int m=0; m<x.length; m++){
if(a==x[m].scroe){
System.out.println("最高分:"+x[m].name);
}
}
System.out.println("平均:"+b/x.length);
for(int n=0; n<x.length; n++)
if(x[n].scroe<60){
System.out.println("不及格:"+x[n].name);
}
}
}
public class test{
String name;
int scroe;
public test(String name,int scroe){
this.name = name;
this.scroe = scroe;
}
public static void main(String[]args){
test x[] = new test[5];
x[0]= new test("學生1", 60);
x[1]= new test("學生2", 87);
x[2]= new test("學生3", 47);
x[3]= new test("學生4", 50);
x[4]= new test("學生5", 66);
int a =0;
int b = 0;
for(int i=0; i<x.length; i++){
b+= x[i].scroe;
if(a<x[i].scroe){
a= x[i].scroe;
}
}
for(int m=0; m<x.length; m++){
if(a==x[m].scroe){
System.out.println("最高分姓名:"+x[m].name);
System.out.println("最高分:"+a);
}
}
System.out.println("平均:"+b/x.length);
for(int n=0; n<x.length; n++)
if(x[n].scroe<60){
System.out.println("不及格姓名:"+x[n].name);
System.out.println("不及格分數:"+x[n].scroe);
}
}
}
public class stdEX {
public static void main(String[] args) {
student x[]=new student[5];
x[0]=new student("學生1",60);
x[1]=new student("學生2",87);
x[2]=new student("學生3",47);
x[3]=new student("學生4",50);
x[4]=new student("學生5",66);
student max=x[0];
for(int j=0;jmax.score)
max=x[j];
}System.out.println("最高分:"+max.name);
int sum=0;
for(int j=0;j<x.length;j++){
sum+=x[j].score;
}System.out.println("平均="+sum/x.length);
}
}
public class student {
String name ;
int score;
public student (String x, int y){
name = x;
score = y;
}
public void printData(){
System.out.print("name:"+name);
System.out.println("\tscore:"+score);
}
}
public class ex1 {
public static void main(String[] args) {
student[] X = new student[5];
X[0]= new student ("學生1", 60);
X[1]= new student ("學生2", 87);
X[2]= new student ("學生3", 47);
X[3]= new student ("學生4", 50);
X[4]= new student ("學生5", 66);
for(int i=0; i<X.length; i++)
X[i].printData();
int a =0;
for(int i=0 ; i<5; i++)
a+=X[i].score;
System.out.println("av="+a/5);
for(int i=0 ; i<5; i++)
if(X[i].score<60)
System.out.println("不及格="+X[i].name);
int c = 0 ;
for(int b=0 ; b<5; b++){
if (X[b].score >c)
c = X[b].score;
}System.out.println("最高分="+c);
}
}
public class student {
String name ;
int score;
public student (String x, int y){
name = x;
score = y;
}
public void printData(){
System.out.print("name:"+name);
System.out.println("\tscore:"+score);
}
}
public class ex1 {
public static void main(String[] args) {
student[] X = new student[5];
X[0]= new student ("學生1", 60);
X[1]= new student ("學生2", 87);
X[2]= new student ("學生3", 47);
X[3]= new student ("學生4", 50);
X[4]= new student ("學生5", 66);
for(int i=0; i<X.length; i++)
X[i].printData();
int a =0;
for(int i=0 ; i<5; i++)
a+=X[i].score;
System.out.println("av="+a/5);
for(int i=0 ; i<5; i++)
if(X[i].score<60)
System.out.println("不及格="+X[i].name);
int c = 0 ;
for(int b=0 ; b<5; b++){
if (X[b].score >c)
c = X[b].score;
}System.out.println("最高分="+c);
}
}
public class student {
String name ;
int score;
public student (String x, int y){
name = x;
score = y;
}
public void printData(){
System.out.print("name:"+name);
System.out.println("\tscore:"+score);
}
}
public class ex1 {
public static void main(String[] args) {
student[] X = new student[5];
X[0]= new student ("學生1", 60);
X[1]= new student ("學生2", 87);
X[2]= new student ("學生3", 47);
X[3]= new student ("學生4", 50);
X[4]= new student ("學生5", 66);
for(int i=0; i<X.length; i++)
X[i].printData();
int a =0;
for(int i=0 ; i<5; i++)
a+=X[i].score;
System.out.println("av="+a/5);
for(int i=0 ; i<5; i++)
if(X[i].score<60)
System.out.println("不及格="+X[i].name);
int c = 0 ;
for(int b=0 ; b<5; b++){
if (X[b].score >c)
c = X[b].score;
}System.out.println("最高分="+c);
}
}
張貼留言