網頁

2013年6月11日 星期二

作業

5筆學生分數資料
"學生1", 60
"學生2", 87
"學生3", 47
"學生4", 50
"學生5", 66
  1. 請寫出函數(Java中的類別方法)列出分數最高者的姓名,
  2. 請寫出函數(Java中的類別方法)算出這五個學生的平均分數,
  3. 請寫出函數(Java中的類別方法)列出當中不及格者的資料。

53 則留言:


  1. 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);


    }
    }

    回覆刪除
  2. B9933122 苑珮婕2013年6月11日 下午2:45

    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));
    }
    }

    回覆刪除
  3. B10036036陸語萱2013年6月11日 下午2:45

    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));
    }
    }

    回覆刪除
  4. 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();
    }
    }
    }
    }

    回覆刪除
  5. B10133009 王韋翔2013年6月18日 下午2:44

    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);
    }
    }

    回覆刪除
  6. b10133025王柏文2013年6月18日 下午2:46

    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); }}.

    回覆刪除
  7. B10133013林子恩2013年6月18日 下午2:47

    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);
    }
    }

    回覆刪除
  8. b10133051張丞緯2013年6月18日 下午6:31

    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);
    }
    }

    回覆刪除
  9. B10133048饒家華2013年6月20日 下午1:56

    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);
    }

    }

    回覆刪除
  10. b10133045林玹安2013年6月20日 下午2:22

    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);
    }
    }
    }

    回覆刪除
  11. 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);
    }
    }
    }

    回覆刪除
  12. b10133016王致翔2013年6月20日 下午2:25

    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);
    }
    }
    }

    回覆刪除
  13. 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));
    }
    }

    回覆刪除
  14. B10133046邱誌寬2013年6月20日 下午2:30

    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);
    }
    }

    回覆刪除
  15. B10133047 鄭兆珊2013年6月20日 下午2:30


    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);



    }
    }

    回覆刪除
  16. B10133048饒家華2013年6月20日 下午2:40

    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);
    }

    }

    回覆刪除
  17. 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);
    }

    }

    回覆刪除
  18. b10133032黃徐琨2013年6月25日 下午1:09

    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);
    }
    }
    }

    回覆刪除
  19. B10133050張珈祥2013年6月25日 下午1:10

    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);

    }
    }

    回覆刪除
  20. B10133003王冠文2013年6月25日 下午2:15

    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);
    }
    }
    }

    回覆刪除
  21. B10133015楊超文2013年6月25日 下午2:15

    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);
    }
    }


    回覆刪除
  22. B10133044吳盛盟2013年6月25日 下午2:15

    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);
    }
    }
    }

    回覆刪除
  23. B10133027黃為邦2013年6月25日 下午2:15

    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);
    }
    }


    回覆刪除
  24. B10133005 李沛澤2013年6月25日 下午2:16

    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);
    }
    }
    }

    回覆刪除
  25. b10133021吳屹軒2013年6月25日 下午2:17

    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);
    }
    }
    }


    回覆刪除
  26. B10133005李沛澤2013年6月25日 下午2:17

    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);
    }
    }
    }

    回覆刪除
  27. B10133030林潔如2013年6月25日 下午2:17

    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));
    }
    }

    回覆刪除
  28. B10133018翁湘姿2013年6月25日 下午2:18

    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);
    }

    }

    回覆刪除
  29. B10133031 邱敏惠2013年6月25日 下午2:18

    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);
    }
    }
    }

    回覆刪除
  30. B10133005李沛澤2013年6月25日 下午2:18

    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);
    }
    }
    }

    回覆刪除
  31. B10133011 黃怡蓁2013年6月25日 下午2:19

    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);
    }
    }
    }

    回覆刪除
  32. B10133038池侑承2013年6月25日 下午2:20

    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);
    }

    }

    回覆刪除
  33. 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));
    }
    }

    回覆刪除
  34. B10133042沈俞宜2013年6月25日 下午2:23

    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);
    }
    }


    回覆刪除
  35. B10133014 吳欣怡2013年6月25日 下午2:24

    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);
    }
    }

    回覆刪除
  36. B10133040溫翊惠2013年6月25日 下午2:25


    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);


    }
    }


    回覆刪除
  37. B10133053古聿穎2013年6月25日 下午2:25

    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 {


    回覆刪除
  38. B10133002 謝佩紋2013年6月25日 下午2:26

    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);
    }
    }

    回覆刪除
  39. B10133053古聿穎2013年6月25日 下午2:26

    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 {


    回覆刪除
  40. B10133002 謝佩紋2013年6月25日 下午2:29

    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);
    }
    }

    回覆刪除
  41. B10133033呂之筠2013年6月25日 下午2:29

    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();
    }
    }
    }
    }

    回覆刪除
  42. B10133003王冠文2013年6月25日 下午2:33

    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);
    }
    }
    }



    回覆刪除
  43. 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();
    }
    }
    }
    }

    回覆刪除
  44. 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);
    }
    }

    回覆刪除
  45. B10133036孫翊玲2013年6月25日 下午3:58

    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);
    }
    }
    }

    回覆刪除
  46. B10133010蔡以翎2013年6月25日 下午3:59

    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);
    }
    }
    }

    回覆刪除
  47. B10133004徐芷瑩2013年6月25日 下午4:01

    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);
    }
    }
    }

    回覆刪除
  48. B10133010蔡以翎2013年6月25日 下午4:01

    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);
    }
    }
    }

    回覆刪除
  49. B10133049 連于瑄2013年6月25日 晚上7:37

    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);
    }
    }
    }

    回覆刪除
  50. 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);
    }
    }

    回覆刪除
  51. B10133019 王騰侑2013年6月27日 下午1:27

    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);


    }
    }

    回覆刪除
  52. B10133019 王騰侑2013年6月27日 下午1:27

    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);


    }
    }

    回覆刪除
  53. B10133043陳宗霖2013年6月27日 下午1:34

    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);


    }
    }

    回覆刪除

HTML 編輯器