Question: Java Net Beans Part II: ArrayList and Inheritance [40 points] Question 1 [20 points] Implement the class Audio only. The code of the classes Disk

Java Net Beans Part II: ArrayList and Inheritance [40 points] Question 1[20 points] Implement the class Audio only. The code of the classesDisk and Video is provided below. Disk -title: String -play Time: int// in minutes + Disk(title: String, playTime: int) + getters + toString():Java Net Beans

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 -play Time: 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 + getTracks List(): ArrayList + addTrack(name: String): void +removeTrack(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 1 private String title; private int playTime; 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 getplayTime () { return playTime; ) public String toString() { return "Title: " + title + " Play time: " } + 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. remove Track 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; } + director + public String toString() { String result = super.toString()+" Video Director = " Description = " + description; return result; Question 2 [20 points] Write a client class (application) in which you: a) Create an array of 10 disks (not an ArrayList). Write code to insert one audio and one video in the array. The values of these two objects are given by the programmer. Assume the remaining cells of the array D are filled with audio and video objects. b) Write code that displays the director of each video disk in D. c) Write code that adds one track named "Hello" to the first audio in the array D. Note: You have to search for the first audio disk and not assume it is in cell 0 or 1. d) Prompt the user to enter a track name as a String. Then, display whether the name is found among the audio disks in the array or not. You need to check the trackslist of cach audio disk in the array D

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!