Question: Exercise 5: Creating a CDImage Class using Composition (has-a relationship) 6.1 Create a new project, call it Lab6Proj, create class Song as it is given

Exercise 5: Creating a CDImage Class using Composition (has-a relationship) 6.1 Create a new project, call it Lab6Proj, create class Song as it is given below 6.2 Create a CDlmage class to represent a music CD. The constructor takes four parameters: the title of the CD and three songs. The CDImage class uses the song class and should contain methods to accomplish the following: . The necessary set and get methods. . CDTime() method to return the total time of the CD in minutes. . toString() method to print the CD title and the three songs (title, artist and duration). 6.3 Write a program CDImage Test that tests all of the methods in the CDImage class. 6.4 Add Javadoc comments to document this project and then generate the intended documentation. /* Song.java is a class for maintaining basic information about a song. * Created and Modified by William Mullally */ public class Song { private String title; private String artist; private int duration; //Constructors public Song (String songTitle, int songDuration) { title = songTitle; duration = songDuration; artist = null; { public Song (String songTitle, int songDuration, String songArtist) title = songTitle; duration = songDuration; artist = songArtist; //Accessors public String getTitle() return title; { public String getArtist() return artist; { { public int getDuration () return duration; { public void setArtist(String songArtist) artist = songArtist ; //toString public String toString() { return String.format ("Song: %s by %s of duration (mins) %d ", title, artist, duration)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
