Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a UML diagram for the project based on the resources provided and also your inputs . JAVA: Complete the below project in JAVA coding. The

a UML diagram for the project based on the resources provided and also your inputs .

JAVA: Complete the below project in JAVA coding.

The basic system components. Jukebox CD Song Artist Playlist Display (displays details on the screen) Now, let's break this down further and think about the possible actions. Playlist creation (includes add, delete, and shuffle) CD selector Song selector Queuing up a song Get next song from playlist A user also can be introduced: Adding Deleting

The Code in JAVA:

public class Jukebox {

private CDPlayer cdPlayer;

private User user;

private Set cdCollection;

private SongSelector ts;

public Jukebox(CDPlayer cdPlayer, User user, Set cdCollection, SongSelector ts) {

...

}

public Song getCurrentSong() {

return ts.getCurrentSong();

}

public void setUser (User u) {

this. user = u;

}

}

//Like a real CD player, the CDPlayer class supports storing just one CD at a time. The CDs that are not in play are stored in the jukebox.

class CDPlayer {

private Playlist p;

private CD c;

/* Constructors. */

public CDPlayer(CD c, Playlist p) {

...

}

public CDPlayer(Playlist p) { this.p = p; }

public CDPlayer(CD c) { this.c = c; }

/* Play song */ 11 public void playSong(Song s) { ... }

/* Getters and setters */

public Playlist getPlaylist() { return p; }

public void setPlaylist(Playlist p) { this.p = p; }

public CD getCD() { return c; }

public void setCD(CD c) { this.c = c; }

}

//The Playlist manages the current and next songs to play. It is essentially a wrapper class for a queue and offers some additional methods for convenience.

public class Playlist {

private Song song;

private Queue queue;

public Playlist(Song song, Queue queue) {

...

}

public Song getNextSToPlayQ {

return queue. peek();

}

public void queueUpSong(Song s) {

queue. add(s);

}

}

//The classes for CD, Song, and User are all fairly straightforward. They consist mainly of member variables and getters and setters.

public class CD {

/* data for id, artist, songs, etc */

}

public class Song {

/* data for id, CD (could be null), title, length, etc */

}

public class User {

private String name;

public String getName() { return name; }

public void setName(String name) { this.name }

public long getlD() { return ID; }

public void setID(long ID) { ID = iD; }

private long ID;

public User(String name, long iD) { ... }

public User getUser() { return this; }

public static User addUser(String name, long iD) { ... }

}

Step by Step Solution

3.44 Rating (151 Votes )

There are 3 Steps involved in it

Step: 1

Heres a UML diagram representing the Jukebox system based on the provided code and additional requir... 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

Step: 3

blur-text-image

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

Accounting Principles

Authors: Paul D Kimmel, Donald E Kieso Jerry J Weygandt

IFRS global edition

1-119-41959-4, 470534796, 9780470534793, 9781119419594 , 978-1119419617

More Books

Students also viewed these Programming questions

Question

Explain all drawbacks of the application procedure.

Answered: 1 week ago

Question

Determine Leading or Lagging Power Factor in Python.

Answered: 1 week ago