See below.
Remember that the super reference
must be in the first statement of the constructor.
toString()Here are the class definitions so far:
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
. . .
}
class MusicVideo extends Video
{
private String artist;
private String category;
// constructor
public MusicVideo ( String ttl, int len, String art, String cat )
{
super( ttl, len );
artist = art;
category = cat;
}
// The toString() method goes here
}
To finish the MusicVideo class,
write a toString() method for it.
Use a super reference to do the things
already done by the parent class.
Write the toString() method.