Question: Part II: ArrayList and Inheritance [40 points] Question 1 [20 points] Implement the class Audio only. The code of the classes Disk and Video is
![Part II: ArrayList and Inheritance [40 points] Question 1 [20 points]](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f45e5415210_96366f45e537e01a.jpg)

Part II: ArrayList and Inheritance [40 points] Question 1 [20 points] Implement the class Audio only. The code of the classes Disk and Video is provided below. Disk title: String - playTime: int // in minutes + Disk(title: String, playTime: int) + getters + toString(): String Audio -artist: String tracksList: ArrayList + Audio(artist: String, ti: String, pTime: int) + getArtist(): String + getTracksList(): ArrayList + addTrack(name: String): void + remove Track(name: String): void + toString(): String Video - director: String - description: String + Video(dir: String, desc: String, ti: String, pTime: int) + toString(): String A. The Disk class is the super class. The code is below: public class Disk { private String title; private int playtime; public Disk (String title, int playTime) { this.title = title; this.playTime = playTime; } public String getTitle() { return title; } public int getplaytimet return playTime; } public String toString() { return "Title: " + title + " Play time: } 4/5 " + playTime; } . . . B. The Audio class inherits from the class Disk. It has as data a String artist and an array list tracksList to store the names of the tracks. This class has: A constructor that initializes all attributes and creates the tracksList. The getter methods for the attributes. addTrack method that takes as parameter the name of the track ( to be added to the array list. removeTrack method that takes as parameter the name of the track to be deleted from the array list. A toString() method that overrides the toString() method in the Disk class by adding the data fields of the Audio class in the form shown below. The toString returns: "Title: " + title + " Play time: " + playTime; "Artist name: " + artist + " List of tracks: "; "track 1:"+ nameOfTrackl; "track 2:"+ nameOfTrack2; "track 3:"+ nameOfTrack3; etc.. C. The Video class inherits from the class Disk. The code is below: { public class Video extends Disk private String director; private String description; public Video (String director, String description, String title, int playTime) { super (title, playTime); this.director = director; this.description = description; } 11 + director + public String toString() { String result = super.toString() + " Video Director = " Description = " + description; return result; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
