MusicVideo
inherits title
, length
,
and avail
from its
superclass and adds artist
and category
.
Notice that MusicVideo
inherits only from its superclass VideoTape
.
It does not inherit anything from its sibling class Movie
.
Here is the definition so far:
class VideoTape { String title; // name of the item int length; // number of minutes boolean avail; // is the tape in the store? // constructor public VideoTape( String ttl, int lngth ) { title = ttl; length = lngth; avail = true; } public void show() { System.out.println( title + ", " + length + " min. available:" + avail ); } } class MusicVideo extends VideoTape { String artist; String category; // The constructor will go here // The show() method will go here }
A constructor is needed for MusicVideo
.
The constructor will use four parameters to initialize
title
, length
,
artist
and category
.
Initialize avail
to true without using a parameter.