当前位置:编程学习 > JAVA >>

急需哪位帮我修改一下我的Java code

下面是我写的Java code

public class UndergradStudent extends Student { 

public UndergradStudent(String name, int UFID, String dob, double gpa) {
super(name, UFID, dob, gpa);
}

public UndergradStudent(String name, int UFID, String dob, double gpa, Course[] courses) {
super(name, UFID, dob, gpa, courses);
}

public boolean addCourse(Course course) {

for(int i=0; i<courses.length; i++) {
if(courses[i] == null){
if(course.getNumber() < 5000 && super.getNumCoursesEnrolled() < 4 && course.addStudent(this)){
courses[i] = course;
numCoursesEnrolled++;
return true;

}
else return false;

}return false;
} return false;
}

public String toString() {
return super.toString(); 
}
}
×××××××××××××××××××××××××××××××××××××××××××××××××××××××
下面是对code的要求
The UndergradStudent class

The UndergradStudent class is a subclass of the Student class.
Properties:
----------
none (only inherited from the superclass)

Constructors:
------------
1) public UndergradStudent(String name, int UFID, String dob, double gpa)
   calls the superclass' constructor
   
2) public UndergradStudent(String name, int UFID, String dob, double gpa, Course[] courses)
   calls the superclass' constructor
  
Methods:
--------
-addCourse(Course course) - Implements the addCourse method declared in the super-class. Only adds a course if all of these conditions are satisfied:
   1) The course number is < 5000 (greater than or equal to 5000 implies a graduate course)
   2) if the number of courses the student is enrolled in is less than the max number of courses the student can take
   3) if the course can accomodate the student (HINT: Use the addStudent(...) method in the Course class)
   
   If these conditions are satisfied, the course is put inside the courses array - this is done by putting the course in the first spot it finds
   a null object. Number of courses the student is enrolled in is increased by 1 and the method returns true
   
   false otherwise.

-toString() - The toString() method is public and returns a String. 
              It should return a String in this format [HINT: Use the super class' toString() method somehow]: 
              
      Undergrad Student:
              Name: name
              UFID: UFID
              D.O.B: dob
      GPA: gpa
      Courses enrolled in:
      Course 1:
      [Course 1 info goes here] (HINT: Use the Course class' toString method)
      Course 2:
      [Course 2 info goes here]
      ...
      and so on

哪位要是能帮我修改一下感激不尽
可以给我发个Email, rayy2007@hotmail.com
或者用QQ联系我1834972557 --------------------编程问答-------------------- --------------------编程问答-------------------- 楼主顺便把Student的代码也贴出来吧,这样好看点
补充:Java ,  Java SE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,