Question: in java create an ArrayList-based application that manages a collection of DVDs. Information about a DVD includes title, category, running time, year, and price. The

in java create an ArrayList-based application that manages a collection of DVDs. Information about a DVD includes title, category, running time, year, and price. The list of DVDs and the information for each DVD are stored in a text file before and after the program is executed.

You will need to write the code for one interface (DVDCollectionInterface) and three classes (DVD, DVDCollection, and DVDApplication), for which the details are given below.

Interface DVDCollectionInterface - The interface file for the DVD collection. This interface should include the following methods:

loadData this method should have a file name as the parameter. The method loads the data containing the DVD collection entries from a given file.

search this method should have a DVD title as the parameter. It should return the DVD entry if found, or null if not found.

add this method is used to add a new DVD. It should have five parameters that represent the title, category, running time, year, and price of a DVD. If the title is already in the DVD collection, there is no need to add or change anything. Otherwise, the DVD is added to the collection. It returns the DVD entry if it is already in the DVD collection, or returns null if a new one is added.

remove this method should have a title as the parameter. It should remove the DVD from the collection if the title is found. It returns the DVD entry which was removed, or returns null if the title is not found.

displayDVDsInCategory this method should have a category as the parameter. It should return an arrayList object with all the DVDs in the specified category. If there is no DVD in the given category, the size of the arrayList will be zero.

save this method has no parameter. It should write the DVD collection back to the file (the same file is used for both reading and writing).

DVDApplication - The class for the main program. You will need to read the data from input file, display menu options, and perform various tasks that user selects.

DVDCollection - The class for the actual DVD collection. The DVD collection need to have an ArrayList object and possibly other variables, such as the input file name and a boolean variable to indicate whether the directory has been modified. You will need to write the code for all the methods specified in the DVDCollectionInterface. You may add additional methods as needed to this class, however ALL additional methods you add MUST be declared as private.

DVD - The class containing all of the information about one DVD.

-The information to be stores is: the title of the DVD, the category for the DVD, the running time for the DVD (use String type for the running time), the year the DVD was released, and the price paid for the DVD.

- You should include get methods for ALL five of the data fields.

- You should include set methods for all of the data fields EXCEPT title. The title of the DVD is not allowed to be changed.

-You will need to write the code for the toString method.

-You will need to write the code for the equals method. This method should have one parameter of Object type. Two DVD objects are considered to be equal if they have the same titles.

- You will need to write the code for the compareTo method. This method should have one parameter of Object type. This method is to test the order of two DVD objects to see which one comes first alphabetically by their titles. Note that in order to have this method, your DVD class should implement the Comparable interface.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!