This is for Java. Can anybody please help me get started on this project? I need
ID: 3769140 • Letter: T
Question
This is for Java. Can anybody please help me get started on this project? I need help creating the classes associated with this project that it details in the instructions. Based on the code we were provided below and the instructions, I am attempting to create a customer class, a media interface, an album class, and a movie class. The album and movie classes would implement media in this instance.
https://www.cs.umd.edu/class/fall2015/cmsc131/content/projects/MediaRentalManager/MediaRentalManager.html
The username is cmsc131 and the password is java131. If that doesn't work then it is the other way around (username java131 password cmsc131)
Here is what they have given us:
package mediaRentalManager;
import java.util.ArrayList;
/**
* Interface that defines the functionality expected from
* the media rental manager. The two possible media we can have
* are movies and music albums. A movie has a title, a number of copies
* that are available for rent, and a rating (e.g., "PG"). An album
* has a title, a number of copies, an artist, and a list of songs (String
* with title of songs separated by commas).<br>
* <br>
* <b>IMPORTANT:</b>The database of the media rental manager, must define and use two
* ArrayList. One stores the media (both Movies and Album information)
* and one stores Customer information. You will lose significant credit
* if you do not define and use these ArrayList objects.
*
* @author cmsc131
*
*/
public interface MediaRentalManagerInt {
/**
* Adds the specified customer to the database. The address is a physical address (not e-mail).
* The plan options available are: <b>LIMITED</b> and <b>UNLIMITED</b>. LIMITED
* defines a default maximum of two media that can be rented.
* @param name
* @param address
* @param plan
*/
public void addCustomer(String name, String address, String plan);
/**
* Adds the specified movie to the database. The possible values for rating are
* "PG", "R", "NR".
* @param title
* @param copiesAvailable
* @param rating
*/
public void addMovie(String title, int copiesAvailable, String rating);
/**
* Adds the specified album to the database. The songs String includes
* a list of the title of songs in the album (song titles are separated by
* commas).
* @param title
* @param copiesAvailable
* @param artist
* @param songs
*/
public void addAlbum(String title, int copiesAvailable, String artist, String songs);
/**
* This set the number of media associated with the LIMITED plan.
* @param value
*/
public void setLimitedPlanLimit(int value);
/**
* Returns information about the customers in the database. The information is
* presented sorted by customer name. See the public tests for the format
* to use.
* @return
*/
public String getAllCustomersInfo();
/**
* Returns information about all the media (movies and albums) that are part
* of the database. The information is presented sorted by media title. See
* the public tests for the format to use.
* @return
*/
public String getAllMediaInfo();
/**
* Adds the specified media title to the queue associated with a customer.
* @param customerName
* @param mediaTitle
* @return false if the mediaTitle is already part of the queue (it will not be
* added)
*/
public boolean addToQueue(String customerName, String mediaTitle);
/**
* Removes the specified media title from the customer's queue.
* @param customerName
* @param mediaTitle
* @return false if removal failed for any reason (e.g., customerName not found)
*/
public boolean removeFromQueue(String customerName, String mediaTitle);
/**
* Processes the requests queue of each customer. The customers will be processed
* in alphabetical order. For each customer, the requests queue will be checked
* and media will be added to the rented queue, if the plan associated with
* the customer allows it, and if there is a copy of the media available.
* For UNLIMITED plans the media will be added to the rented queue always,
* as long as there are copies associated with the media available. For
* LIMITED plans, the number of entries moved from the requests queue to the rented
* queue will depend on the number of currently rented media, and whether
* copies associated with the media are available.<br>
* <br>
* For each media that is rented, the following message will be generated:<br>
* "Sending [mediaTitle] to [customerName]" <br>
*
* @return
*/
public String processRequests();
/**
* This is how a customer returns a rented media. This method will remove the item
* from the rented queue and adjust any other values that are necessary (e.g., copiesAvailable)
* @param customerName
* @param mediaTitle
* @return
*/
public boolean returnMedia(String customerName, String mediaTitle);
/**
* Returns a SORTED ArrayList with media titles that satisfy the provided parameter values.
* If null is specified for a parameter, then that parameter should be ignore in the
* search. Providing null for all parameters will return all media titles.
* @param title
* @param rating
* @param artist
* @param songs
* @return
*/
public ArrayList<String> searchMedia(String title, String rating, String artist, String songs);
}
Explanation / Answer
import java.util.ArrayList; /** * Interface that defines the functionality expected from * the media rental manager. The two possible media we can have * are movies and music albums. A movie has a title, a number of copies * that are available for rent, and a rating (e.g., "PG"). An album * has a title, a number of copies, an artist, and a list of songs (String * with title of songs separated by commas).<br> * <br> * <b>IMPORTANT:</b>The database of the media rental manager, must define and use two * ArrayList. One stores the media (both Movies and Album information) * and one stores Customer information. You will lose significant credit * if you do not define and use these ArrayList objects. * * @author cmsc131 * */ public interface MediaRentalManagerInt { /** * Adds the specified customer to the database. The address is a physical address (not e-mail). * The plan options available are: <b>LIMITED</b> and <b>UNLIMITED</b>. LIMITED * defines a default maximum of two media that can be rented. * @param name * @param address * @param plan */ public void addCustomer(String name, String address, String plan); /** * Adds the specified movie to the database. The possible values for rating are * "PG", "R", "NR". * @param title * @param copiesAvailable * @param rating */ public void addMovie(String title, int copiesAvailable, String rating); /** * Adds the specified album to the database. The songs String includes * a list of the title of songs in the album (song titles are separated by * commas). * @param title * @param copiesAvailable * @param artist * @param songs */ public void addAlbum(String title, int copiesAvailable, String artist, String songs); /** * This set the number of media associated with the LIMITED plan. * @param value */ public void setLimitedPlanLimit(int value); /** * Returns information about the customers in the database. The information is * presented sorted by customer name. See the public tests for the format * to use. * @return */ public String getAllCustomersInfo(); /** * Returns information about all the media (movies and albums) that are part * of the database. The information is presented sorted by media title. See * the public tests for the format to use. * @return */ public String getAllMediaInfo(); /** * Adds the specified media title to the queue associated with a customer. * @param customerName * @param mediaTitle * @return false if the mediaTitle is already part of the queue (it will not be * added) */ public boolean addToQueue(String customerName, String mediaTitle); /** * Removes the specified media title from the customer's queue. * @param customerName * @param mediaTitle * @return false if removal failed for any reason (e.g., customerName not found) */ public boolean removeFromQueue(String customerName, String mediaTitle); /** * Processes the requests queue of each customer. The customers will be processed * in alphabetical order. For each customer, the requests queue will be checked * and media will be added to the rented queue, if the plan associated with * the customer allows it, and if there is a copy of the media available. * For UNLIMITED plans the media will be added to the rented queue always, * as long as there are copies associated with the media available. For * LIMITED plans, the number of entries moved from the requests queue to the rented * queue will depend on the number of currently rented media, and whether * copies associated with the media are available.<br> * <br> * For each media that is rented, the following message will be generated:<br> * "Sending [mediaTitle] to [customerName]" <br> * * @return */ public String processRequests(); /** * This is how a customer returns a rented media. This method will remove the item * from the rented queue and adjust any other values that are necessary (e.g., copiesAvailable) * @param customerName * @param mediaTitle * @return */ public boolean returnMedia(String customerName, String mediaTitle); /** * Returns a SORTED ArrayList with media titles that satisfy the provided parameter values. * If null is specified for a parameter, then that parameter should be ignore in the * search. Providing null for all parameters will return all media titles. * @param title * @param rating * @param artist * @param songs * @return */ public ArrayList<String> searchMedia(String title, String rating, String artist, String songs); }
import java.util.ArrayList; public class MediaRentalManagerImpl implements MediaRentalManagerInt { @Override public void addCustomer(String name, String address, String plan) { //add customer data here } @Override public void addMovie(String title, int copiesAvailable, String rating) { //add movie data here } @Override public void addAlbum(String title, int copiesAvailable, String artist, String songs) { // TODO Auto-generated method stub } @Override public void setLimitedPlanLimit(int value) { } @Override public String getAllCustomersInfo() { return null; } @Override public String getAllMediaInfo() { //get all movies here return null; } @Override public boolean addToQueue(String customerName, String mediaTitle) { //add media object to queue here return false; } @Override public boolean removeFromQueue(String customerName, String mediaTitle) { //remove media object to queue here return false; } @Override public String processRequests() { return null; } @Override public boolean returnMedia(String customerName, String mediaTitle) { //return true/false based on media object available return false; } @Override public ArrayList<String> searchMedia(String title, String rating, String artist, String songs) { //return list based on media avaliable return null; } }
public class Customer { String name; String address; String plan; public Customer(String name, String address, String plan) { super(); this.name = name; this.address = address; this.plan = plan; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getPlan() { return plan; } public void setPlan(String plan) { this.plan = plan; } public Customer() { // TODO Auto-generated constructor stub } }
public class Movie { String title; int copiesAvailable; String rating; public Movie(String title, int copiesAvailable, String rating) { super(); this.title = title; this.copiesAvailable = copiesAvailable; this.rating = rating; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getCopiesAvailable() { return copiesAvailable; } public void setCopiesAvailable(int copiesAvailable) { this.copiesAvailable = copiesAvailable; } public String getRating() { return rating; } public void setRating(String rating) { this.rating = rating; } public Movie() { // TODO Auto-generated constructor stub } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub } }
public class Media { String title; String rating; String artist; String songs; public Media(String title, String rating, String artist, String songs) { super(); this.title = title; this.rating = rating; this.artist = artist; this.songs = songs; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getRating() { return rating; } public void setRating(String rating) { this.rating = rating; } public String getArtist() { return artist; } public void setArtist(String artist) { this.artist = artist; } public String getSongs() { return songs; } public void setSongs(String songs) { this.songs = songs; } public Media() { // TODO Auto-generated constructor stub } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.