Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 [20 points] mplement the class Audio only. The code of the classes Disk and Video is provided below. Disk title: String - playTime:

image text in transcribed

image text in transcribed

Question 1 [20 points] mplement 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 + 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 Disx private String tatlos private int playtime: public Disk (String Licle, in playTime) this.title title this.playTimeplayTime: public String geltille return title; public irit getplaylime () { return playtime: public String tostring return "Title: + Litle + WinPlay time: playrime: . . 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:"+ nameOfTracki, "track 2:"+ nameOfTrack2; "track 3:"+ nameOfTrack3; . 11 + 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 D 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 Page 5ell 15 the list all in it array D. Note: You have to search for the first audio disk and not assume SITUTUOTT

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

The best way to describe a variable - length list in BNF is to use:

Answered: 1 week ago