0

I have a homework question that I'm a little thrown off by. Mostly because we haven't messed with strings much in class. Any help would be greatly appreciated.

Using the UML class diagram as a reference, complete the Student class declaration. (fill in the blanks)

class Person {
public String firstName;
public String lastName ;

public _____() { // constructor
lastName = "";
}

public void PayFees(double fee) {
/* ... */
}
} // end Person

class Student _________ __________ {
public String __________ ;

public void ChangeMajor(String major) { 
__Major___ = major;
/* ... */
}

public void PayFees(double fee) {
/* … */ 
}
} // end 

UML Diagram:
Person
______
firstName : String
lastName : String
_______
PayFees(double)
^
|
|
Student
______
major : String
_________
ChangeMajor(String)
PayFees(double)

What I need is the blanks filled in the Java code above. Thanks for your help

3
Contributors
6
Replies
7
Views
4 Years
Discussion Span
Last Post by greg2186
0

Err... How about you do it yourself first? And then ask us whether or not it is correct. I am not going to do your homework for you but I could help you correct it.

0

Ok, here's my guess. I didn't think that you would know what I was trying to do if I had my blanks filled in... Thanks

class Person {
  public String firstName;
  public String lastName ;

  public __void___() { // constructor
    lastName = "";
  }

  public void PayFees(double fee) {
      /* ...  */
  }
}  // end Person

class Student ____extends__    ____Person {
  public String ____Major______ ;

  public void ChangeMajor(String major) {         
   __this.Major___ = major;
     /* ... */
  }

   public void PayFees(double fee) {
    /* …  */ 
   }
}  // end 
0

Ok how about now?

class Person {
  public String firstName;
  public String lastName ;
  public __Person___() { // constructor
    lastName = "";
  }
  public void PayFees(double fee) {
      /* ...  */
  }
}  // end Person
class Student ____extends__    ____Person {
  public String ____Major______ ;
  public void ChangeMajor(String major) {         
   __this.Major___ = major;
     /* ... */
  }
   public void PayFees(double fee) {
    /* …  */ 
   }
}  // end 
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.