Question
Implement a class called MusicExchangeCenter which represents the company website that users log in and out of in order to download music. The class should
Implement a class called MusicExchangeCenter which represents the company website that users log in and out of in order to download music. The class should have this attribute:
users - an ArrayList of all registered Users (which may be either logged on or not logged on).
implement a class called MusicExchangeCenter which represents the company website that users log in and out of in order to download music. The class should have this attribute:
users - an ArrayList of all registered Users (which may be either logged on or not logged on).
Create the following methods:
A zero-parameter constructor that sets attributes properly.
An onlineUsers() method that returns an ArrayList of all Users that are currently online. Note that this method creates and returns a new ArrayList each time it is called.
An allAvailableSongs() method that returns a new ArrayList of all Songs currently available for download (i.e., all songs that are available from all logged-on users). Note that this method creates and returns a new ArrayList each time it is called.
A toString() method that returns a string representation of the music center showing the number of users currently online as well as the number of songs currently available. (e.g., "Music Exchange Center (3 clients on line, 15 songs available)")
. A userWithName(String s) method that finds and returns the user object with the given name if it is in the list of users. If not there, null should be returned.
A registerUser(User x) method that adds a given User to the music centers list of users, provided that there are no other users with the same userName. If there are other users with the same userName, then this method does nothing. Use the userWithName() method above.
An availableSongsByArtist(String artist) method that returns a new ArrayList of all Songs currently available for download by the specified artist. Note that this method creates and returns a new ArrayList each time it is called.
File AutoSave C on 8 : 0 Document2 - Word Picture Tools Sign in - Ox Home Insert Design Layout References Mailings Review ViewHelp Format Tell me what you want to do e Share Calibri (Body) - 11 - A A Aa - - E-E-F- FEE ! 1 P Find - bct AaBbccc 3. Replace Paste * Format Painter B 1 U - albo x, x? A - ay - A - E === - - - 1 Normal 1 No Spac... Heading 1 Heading 2 Title Subtitle Subtle Em.. Emphasis - Clipboard Font Paragraph Styles Xcut De Copy Editing Here are simple Song and User classes that represent a song that is available at the Music Exchange Center and a user of the Music Exchange Center that logs in to download music: public class Song private String private String private int title: Artist: duration public Song 01 this (*. *", 0, 0); public Song (stringt, string a, int n, int s) { owner null; title= t: artista: duration 60 8: public String getTitle() { return title; } public String getArtist() { return artisti ) public int getDuration 0 return duration: public int getMinutes) return duration / 60: public int getSeconds() { return duration 60: Page 6 of 788 words IN gp G - + 100Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started