Question: 1. Download Item.java and MusicLibrary.java . 2. Write the subclass CD.java based on the UML below. CD is a subclass of Item. Item protected String

1. Download Item.java and MusicLibrary.java . 2. Write the subclass CD.java based on the UML below. CD is a subclass of Item. Item protected String title protected int playingTime //in minutes public Item! ) //title is "unknown", playing Time is 0 public Item(String the Title, int time) public double calcTimeInHrs( ) //returns the playing Time converted to hours public String toString( ) inherits/extends CD private String artist private int numberOfTracks /umber of tracks on a CD public CD( ) //artist is "unknown", numberOfTracks is 0 public CD(String the Title, int time, String theArtist, int tracks] public double calcAvgTrackTime( ) : //in minutes. public String toString[ ]: 3. Update the tester class MusicLibrary.java to include the following operations. // create a CD object called cd1. Use the overloaded constructor. The title is "The Wall", the playingTime is 90 minutes, the artist is "Pink Floyd", and the number OfTracks is 26 . // display the state of cdl using toString() in a System.out. printIn() statement. // display cdl's playing time in hours. Use the calcTimeInHrs() method. // display cd1's average track time. // create an Item object called cd2. Use the default constructor. // display the state of cd2 using toString() in a System.out. printIn() statement
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
