網頁

2012年5月17日 星期四

Java作業517

定義class student含constructor, printData等方法
並建立student物件陣列,元素10

22 則留言:

  1. class student{
    String name;
    int id;
    int score;
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println("座號:"+id);
    System.out.println("成績:"+score);
    System.out.println("+++++++++++++++++++++++++++");
    }
    }
    public class homework517 {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("小考",0, 60);
    X[1]=new student("小考",1, 65);
    X[2]=new student("小考",2, 66);
    X[3]=new student("小考",3, 50);
    X[4]=new student("小考",4, 65);
    X[5]=new student("小考",5, 70);
    X[6]=new student("小考",6, 85);
    X[7]=new student("小考",7, 99);
    X[8]=new student("小考",8, 65);
    X[9]=new student("小考",9, 67);

    for(int i=0; i<10; i++)
    X[i].printData();
    }
    }

    回覆刪除
  2. class student{
    String name;
    int id;
    int english;
    int math;
    int computer;
    float average(){
    return (float)(english+math+computer)/3;
    }
    student(String name){
    this.name=name;
    }
    student(String name, int id, int english, int math, int computer){
    this.name=name;
    this.id=id;
    this.english=english;
    this.math=math;
    this.computer=computer;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(english);
    System.out.println(math);
    System.out.println(computer);
    System.out.println(average());
    System.out.println("+++++++++++++++++++++++++++");
    }
    }
    public class no {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60, 65, 81);
    X[1]=new student("你好1",1, 65, 75, 71);
    X[2]=new student("你好2",2, 66, 85, 61);
    X[3]=new student("你好3",0, 60, 65, 81);
    X[4]=new student("你好4",1, 65, 75, 71);
    X[5]=new student("你好5",2, 66, 85, 61);
    X[6]=new student("你好6",0, 60, 65, 81);
    X[7]=new student("你好7",1, 65, 75, 71);
    X[8]=new student("你好8",2, 66, 85, 61);
    X[9]=new student("你好9",0, 60, 65, 81);
    for(int i=0; i<10; i++)
    X[i].printData();
    }
    }

    回覆刪除
  3. class student{
    String name;
    int id;
    int score;
    float average(){
    return ((float)score)/1;
    }
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(score);


    }
    }
    public class hello517 {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60);
    X[1]=new student("你好1",1, 61);
    X[2]=new student("你好2",2, 62);
    X[3]=new student("你好3",3, 63);
    X[4]=new student("你好4",4, 64);
    X[5]=new student("你好5",5, 65);
    X[6]=new student("你好6",6, 66);
    X[7]=new student("你好7",7, 67);
    X[8]=new student("你好8",8, 68);
    X[9]=new student("你好9",9, 69);
    for(int i=0; i<10; i++)
    X[i].printData();

    }
    }

    回覆刪除
  4. class student{
    String name;
    int id;
    int english;
    int math;
    int computer;
    float average(){
    return (float)(english+math+computer)/3;
    }
    student(String name){
    this.name=name;
    }
    student(String name, int id, int english, int math, int computer){
    this.name=name;
    this.id=id;
    this.english=english;
    this.math=math;
    this.computer=computer;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(english);
    System.out.println(math);
    System.out.println(computer);
    System.out.println(average());
    System.out.println("+++++++++++++++++++++++++++");
    }
    }
    public class no {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60, 65, 81);
    X[1]=new student("你好1",1, 65, 75, 71);
    X[2]=new student("你好2",2, 66, 85, 61);
    X[3]=new student("你好3",0, 60, 65, 81);
    X[4]=new student("你好4",1, 65, 75, 71);
    X[5]=new student("你好5",2, 66, 85, 61);
    X[6]=new student("你好6",0, 60, 65, 81);
    X[7]=new student("你好7",1, 65, 75, 71);
    X[8]=new student("你好8",2, 66, 85, 61);
    X[9]=new student("你好9",0, 60, 65, 81);
    for(int i=0; i<10; i++)
    X[i].printData();
    }
    }

    回覆刪除
  5. class student{
    String name;
    int id;
    int score;
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println("座號:"+id);
    System.out.println("成績:"+score);
    System.out.println("+++++++++++++++++++++++++++");
    }
    }
    public class homework517 {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("小考",0, 60);
    X[1]=new student("小考",1, 65);
    X[2]=new student("小考",2, 66);
    X[3]=new student("小考",3, 50);
    X[4]=new student("小考",4, 65);
    X[5]=new student("小考",5, 70);
    X[6]=new student("小考",6, 85);
    X[7]=new student("小考",7, 99);
    X[8]=new student("小考",8, 65);
    X[9]=new student("小考",9, 67);

    for(int i=0; i<10; i++)
    X[i].printData();
    }
    }

    回覆刪除
  6. class student{
    String name;
    int id;
    int score;
    float average(){
    return ((float)score)/1;
    }
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(score);


    }
    }
    public class hello {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 71);
    X[1]=new student("你好1",1, 72);
    X[2]=new student("你好2",2, 73);
    X[3]=new student("你好3",3, 74);
    X[4]=new student("你好4",4, 75);
    X[5]=new student("你好5",5, 76);
    X[6]=new student("你好6",6, 77);
    X[7]=new student("你好7",7, 78);
    X[8]=new student("你好8",8, 79);
    X[9]=new student("你好9",9, 80);
    for(int i=0; i<10; i++)
    X[i].printData();

    }
    }

    回覆刪除
  7. class student{
    String name;
    int id;
    int score;
    float average(){
    return ((float)score)/1;
    }
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(score);


    }
    }
    public class hello{
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60);
    X[1]=new student("你好1",1, 61);
    X[2]=new student("你好2",2, 62);
    X[3]=new student("你好3",3, 63);
    X[4]=new student("你好4",4, 64);
    X[5]=new student("你好5",5, 65);
    X[6]=new student("你好6",6, 66);
    X[7]=new student("你好7",7, 67);
    X[8]=new student("你好8",8, 68);
    X[9]=new student("你好9",9, 69);
    for(int i=0; i<10; i++)
    X[i].printData();

    }
    }

    回覆刪除
  8. class student{
    String name;
    int id;
    int english;
    int math;
    int computer;
    float average(){
    return (float)(english+math+computer)/3;
    }
    student(String name, int id, int english, int math, int computer){
    this.name=name;
    this.id=id;
    this.english=english;
    this.math=math;
    this.computer=computer;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(english);
    System.out.println(math);
    System.out.println(computer);
    System.out.println(average());
    System.out.println("+++++++++++++++++++++++++++");
    }
    }
    public class post {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好0",0,60,65,81);
    X[1]=new student("你好1",1,65,75,71);
    X[2]=new student("你好2",2,66,85,61);
    X[3]=new student("你好3",3,67,65,81);
    X[4]=new student("你好4",4,68,75,71);
    X[5]=new student("你好5",5,69,85,61);
    X[6]=new student("你好6",6,70,65,81);
    X[7]=new student("你好7",7,61,75,71);
    X[8]=new student("你好8",8,62,85,61);
    X[9]=new student("你好9",9,63,85,61);
    for(int i=0; i<10; i++)
    X[i].printData();
    }
    }

    回覆刪除
  9. class student{
    String name;
    int id;
    int english;
    int math;
    int computer;
    float average(){
    return (float)(english+math+computer)/3;
    }
    student(String name){
    this.name=name;
    }
    student(String name, int id, int english, int math, int computer){
    this.name=name;
    this.id=id;
    this.english=english;
    this.math=math;
    this.computer=computer;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(english);
    System.out.println(math);
    System.out.println(computer);
    System.out.println(average());
    System.out.println("+++++++++++++++++++++++++++");
    }
    }
    public class no {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60, 65, 81);
    X[1]=new student("你好1",1, 65, 75, 71);
    X[2]=new student("你好2",2, 66, 85, 61);
    X[3]=new student("你好3",0, 60, 65, 81);
    X[4]=new student("你好4",1, 65, 75, 71);
    X[5]=new student("你好5",2, 66, 85, 61);
    X[6]=new student("你好6",0, 60, 65, 81);
    X[7]=new student("你好7",1, 65, 75, 71);
    X[8]=new student("你好8",2, 66, 85, 61);
    X[9]=new student("你好9",0, 60, 65, 81);
    for(int i=0; i<10; i++)
    X[i].printData();
    }
    }

    回覆刪除
  10. class student{
    String name;
    int id;
    int score;
    float average(){
    return ((float)score)/1;
    }
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(score);


    }
    }
    public class hello517 {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60);
    X[1]=new student("你好1",1, 61);
    X[2]=new student("你好2",2, 62);
    X[3]=new student("你好3",3, 63);
    X[4]=new student("你好4",4, 64);
    X[5]=new student("你好5",5, 65);
    X[6]=new student("你好6",6, 66);
    X[7]=new student("你好7",7, 67);
    X[8]=new student("你好8",8, 68);
    X[9]=new student("你好9",9, 69);
    for(int i=0; i<10; i++)
    X[i].printData();

    }
    }

    回覆刪除
  11. class student{
    String name;
    int id;
    int score;
    float average(){
    return ((float)score)/1;
    }
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(score);
    }
    }
    public class pass {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60);
    X[1]=new student("你好1",1, 61);
    X[2]=new student("你好2",2, 62);
    X[3]=new student("你好3",3, 63);
    X[4]=new student("你好4",4, 64);
    X[5]=new student("你好5",5, 65);
    X[6]=new student("你好6",6, 66);
    X[7]=new student("你好7",7, 67);
    X[8]=new student("你好8",8, 68);
    X[9]=new student("你好9",9, 69);
    for(int i=0; i<10; i++)
    X[i].printData();
    }
    }

    回覆刪除
  12. class student{
    String name;
    int id;
    int score;
    float average(){
    return ((float)score)/1;
    }
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(score);


    }
    }
    public class hello517 {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60);
    X[1]=new student("你好1",1, 61);
    X[2]=new student("你好2",2, 62);
    X[3]=new student("你好3",3, 63);
    X[4]=new student("你好4",4, 64);
    X[5]=new student("你好5",5, 65);
    X[6]=new student("你好6",6, 66);
    X[7]=new student("你好7",7, 67);
    X[8]=new student("你好8",8, 68);
    X[9]=new student("你好9",9, 69);
    for(int i=0; i<10; i++)
    X[i].printData();

    }
    }

    回覆刪除
  13. class student{
    String name;
    int id;
    int score;
    float average(){
    return ((float)score)/1;
    }
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(score);


    }
    }
    public class hello517 {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60);
    X[1]=new student("你好1",1, 61);
    X[2]=new student("你好2",2, 62);
    X[3]=new student("你好3",3, 63);
    X[4]=new student("你好4",4, 64);
    X[5]=new student("你好5",5, 65);
    X[6]=new student("你好6",6, 66);
    X[7]=new student("你好7",7, 67);
    X[8]=new student("你好8",8, 68);
    X[9]=new student("你好9",9, 69);
    for(int i=0; i<10; i++)
    X[i].printData();

    }
    }

    回覆刪除
  14. class student{
    String name;
    int id;
    int score;
    float average(){
    return ((float)score)/1;
    }
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(score);


    }
    }
    public class hello517 {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60);
    X[1]=new student("你好1",1, 61);
    X[2]=new student("你好2",2, 62);
    X[3]=new student("你好3",3, 63);
    X[4]=new student("你好4",4, 64);
    X[5]=new student("你好5",5, 65);
    X[6]=new student("你好6",6, 66);
    X[7]=new student("你好7",7, 67);
    X[8]=new student("你好8",8, 68);
    X[9]=new student("你好9",9, 69);
    for(int i=0; i<10; i++)
    X[i].printData();

    }
    }

    回覆刪除
  15. class student{
    String name;
    int id;
    int score;
    float average(){
    return ((float)score)/1;
    }
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(score);


    }
    }
    public class hello517 {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60);
    X[1]=new student("你好1",1, 61);
    X[2]=new student("你好2",2, 62);
    X[3]=new student("你好3",3, 63);
    X[4]=new student("你好4",4, 64);
    X[5]=new student("你好5",5, 65);
    X[6]=new student("你好6",6, 66);
    X[7]=new student("你好7",7, 67);
    X[8]=new student("你好8",8, 68);
    X[9]=new student("你好9",9, 69);
    for(int i=0; i<10; i++)
    X[i].printData();

    }
    }

    回覆刪除
  16. class student{
    String name;
    int id;
    int score;
    float average(){
    return ((float)score)/1;
    }
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(score);


    }
    }
    public class B10033021 {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60);
    X[1]=new student("你好1",1, 61);
    X[2]=new student("你好2",2, 62);
    X[3]=new student("你好3",3, 63);
    X[4]=new student("你好4",4, 64);
    X[5]=new student("你好5",5, 65);
    X[6]=new student("你好6",6, 66);
    X[7]=new student("你好7",7, 67);
    X[8]=new student("你好8",8, 68);
    X[9]=new student("你好9",9, 69);
    for(int i=0; i<10; i++)
    X[i].printData();

    }
    }

    回覆刪除
  17. class student{
    String name;
    int id;
    int english;
    int math;
    int computer;
    float average(){
    return (float)(english+math+computer)/3;
    }
    student(String name){
    this.name=name;
    }
    student(String name, int id, int english, int math, int computer){
    this.name=name;
    this.id=id;
    this.english=english;
    this.math=math;
    this.computer=computer;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(english);
    System.out.println(math);
    System.out.println(computer);
    System.out.println(average());
    System.out.println("+++++++++++++++++++++++++++");
    }
    }
    public class no {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60, 65, 81);
    X[1]=new student("你好1",1, 65, 75, 71);
    X[2]=new student("你好2",2, 66, 85, 61);
    X[3]=new student("你好3",0, 60, 65, 81);
    X[4]=new student("你好4",1, 65, 75, 71);
    X[5]=new student("你好5",2, 66, 85, 61);
    X[6]=new student("你好6",0, 60, 65, 81);
    X[7]=new student("你好7",1, 65, 75, 71);
    X[8]=new student("你好8",2, 66, 85, 61);
    X[9]=new student("你好9",0, 60, 65, 81);
    for(int i=0; i<10; i++)
    X[i].printData();
    }
    }

    回覆刪除
  18. class student{
    String name;
    int id;
    int english;
    int math;
    int computer;
    float average(){
    return (float)(english+math+computer)/3;
    }
    student(String name, int id, int english, int math, int computer){
    this.name=name;
    this.id=id;
    this.english=english;
    this.math=math;
    this.computer=computer;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(english);
    System.out.println(math);
    System.out.println(computer);
    System.out.println(average());
    System.out.println("+++++++++++++++++++++++++++");
    }
    }
    public class post {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好0",0,60,65,81);
    X[1]=new student("你好1",1,65,75,71);
    X[2]=new student("你好2",2,66,85,61);
    X[3]=new student("你好3",3,67,65,81);
    X[4]=new student("你好4",4,68,75,71);
    X[5]=new student("你好5",5,69,85,61);
    X[6]=new student("你好6",6,70,65,81);
    X[7]=new student("你好7",7,61,75,71);
    X[8]=new student("你好8",8,62,85,61);
    X[9]=new student("你好9",9,63,85,61);
    for(int i=0; i<10; i++)
    X[i].printData();
    }
    }

    回覆刪除
  19. class student{
    String name;
    int id;
    int score;
    float average(){
    return ((float)score)/1;
    }
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(score);


    }
    }
    public class h517 {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60);
    X[1]=new student("你好1",1, 61);
    X[2]=new student("你好2",2, 62);
    X[3]=new student("你好3",3, 63);
    X[4]=new student("你好4",4, 64);
    X[5]=new student("你好5",5, 65);
    X[6]=new student("你好6",6, 66);
    X[7]=new student("你好7",7, 67);
    X[8]=new student("你好8",8, 68);
    X[9]=new student("你好9",9, 69);
    for(int i=0; i<10; i++)
    X[i].printData();

    }
    }

    回覆刪除
  20. class student{
    String name;
    int id;
    int score;
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println("座號:"+id);
    System.out.println("成績:"+score);
    System.out.println("+++++++++++++++++++++++++++");
    }
    }
    public class eeq {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("小考",0, 60);
    X[1]=new student("小考",1, 65);
    X[2]=new student("小考",2, 66);
    X[3]=new student("小考",3, 50);
    X[4]=new student("小考",4, 65);
    X[5]=new student("小考",5, 70);
    X[6]=new student("小考",6, 85);
    X[7]=new student("小考",7, 99);
    X[8]=new student("小考",8, 65);
    X[9]=new student("小考",9, 67);

    for(int i=0; i<10; i++)
    X[i].printData();
    }
    }

    回覆刪除
  21. class student{
    String name;
    int id;
    int english;
    int math;
    int computer;
    float average(){
    return (float)(english+math+computer)/3;
    }
    student(String name, int id, int english, int math, int computer){
    this.name=name;
    this.id=id;
    this.english=english;
    this.math=math;
    this.computer=computer;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(english);
    System.out.println(math);
    System.out.println(computer);
    System.out.println(average());
    System.out.println("+++++++++++++++++++++++++++");
    }
    }
    public class post {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好0",0,60,65,81);
    X[1]=new student("你好1",1,65,75,71);
    X[2]=new student("你好2",2,66,85,61);
    X[3]=new student("你好3",3,67,65,81);
    X[4]=new student("你好4",4,68,75,71);
    X[5]=new student("你好5",5,69,85,61);
    X[6]=new student("你好6",6,70,65,81);
    X[7]=new student("你好7",7,61,75,71);
    X[8]=new student("你好8",8,62,85,61);
    X[9]=new student("你好9",9,63,85,61);
    for(int i=0; i<10; i++)
    X[i].printData();
    }
    }

    回覆刪除
  22. class student01{
    String name;
    int id;
    int score;
    float average(){
    return ((float)score)/1;
    }
    student(String name, int id, int score){
    this.name=name;
    this.id=id;
    this.score=score;
    }
    void printData(){
    System.out.println(name);
    System.out.println(id);
    System.out.println(score);


    }
    }
    public class hello517 {
    public static void main(String[] args) {
    student [] X=new student[10];
    X[0]=new student("你好",0, 60);
    X[1]=new student("你好1",1, 61);
    X[2]=new student("你好2",2, 62);
    X[3]=new student("你好3",3, 63);
    X[4]=new student("你好4",4, 64);
    X[5]=new student("你好5",5, 65);
    X[6]=new student("你好6",6, 66);
    X[7]=new student("你好7",7, 67);
    X[8]=new student("你好8",8, 68);
    X[9]=new student("你好9",9, 69);
    for(int i=0; i<10; i++)
    X[i].printData();

    }
    }

    回覆刪除

HTML 編輯器