go to previous page   go to home page   go to next page hear noise highlighting

Answer:

Yes


Music Video Class

Music video as child of Video

So far the video store application has two classes: Video and Movie. Let's create a new class. MusicVideo is like Video but has two new instance variables: artist and category ("R&B", "Pop", "Classical", "Other" ). Both of these are Strings. The MusicVideo class has its own constructor and its own toString() method. Here is the parent class:



class Video
{
  protected String  title;    // name of the item
  protected int     length;   // number of minutes
  protected boolean avail;    // is the video in the store?

  // constructor
  public Video( String ttl, int lngth )
  {
    title = ttl; length = lngth; avail = true; 
  }

  public void toString()
  {
    return title + ", " + length + " min. available: " + avail ;
  }
  
  // setters and getters
   . . . 
  
}

The new class looks like this:


class  extends
{
  private String  ;     //  the artist
  
  private String  ;     //  the music category

  // constructor will go here (skip for now)
  
  // toString method will go here (skip for now)
  
  // setters and getters
   . . . 
 
}  

QUESTION 20:

Fill in the blanks.


go to previous page   go to home page   go to next page