CS10, 09S, UCSB
H12: (Based on Horstman, Chapters 9, 10, Interfaces & Inheritance) Total points: ? (printable PDF)
Accepted: on paper, in lecture (1-1:50pm) on Monday, May 11th only.
No email submission allowed.
Name: (1 pts)______________________________ UCSBNetID (1 pts) _____________________
Section (2 pts) Circle one: Thu 4pm Fri 10am Fri 11am Fri noon
RectangleMeasurer an inner class, vs. a regular class? Make at least one entry in each box:| pros | cons | |
|---|---|---|
| inner class | ||
| regular class |
class Student _________________ Person
{
...Please turn over for more problems
toString() method of a FacultyMember class that inherits from a Person class. You want to invoke the Person classes toString() method, and just add an asterisk after what that returns in order to show that the person is a faculty member. Fill in the missing code below.
/** toString method for FacultyMember
@return what the Person class method's toString returns, plus an asterisk
*/
public String toString()
{
return + "*";
}
toString() method given above is:
public String toString();
public Person (String firstName, String lastName);public Student (String firstName, String lastName, int permNumber)
{
// now set the instance variables that are specific to student
this.permNumber = permNumber;
}
this.firstName = firstName;
this.lastName = lastName;