The finished class is given below.
MusicVideo
Class
The show()
method for MusicVideo
can use super.show()
where ever it needs to.
It is the first statement (below) because that is
where it makes the most sense.
class Video
{
// stuff ommitted here
public void show()
{
System.out.println( title + ", " + length + " min. available:" + avail );
}
}
class MusicVideo extends Video
{
String artist;
String category;
// constructor
public MusicVideo ( String ttl, int len, String art, String cat )
{
super( ttl, len );
artist = art;
category = cat;
}
public void show()
{
super.show();
System.out.println( "artist:" + artist + " style: " + category );
}
}
You may have noticed a major design flaw in the definitions of these classes — none has a rental price! Say that it was your job to fix this problem. What changes will you make?