1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ksju [112]
3 years ago
15

In this assignment, you will design and create an ArrayList-based application that manages a collection of DVDs. Information abo

ut 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.
Computers and Technology
1 answer:
sergij07 [2.7K]3 years ago
7 0

Create and design an arraylist based application which manages a DVDs collection.

Explanation:

DVD movie consists of a title, a rating (e.g. PG, R, etc.), and a running time in minutes.

In this project, you will create an application to allow the user to maintain a collection of DVD movies using an array.

When the application starts up, it will read in the DVD data from a text file to initialize the array, if the file is available. If the file is not there, then the program starts with an empty array. If the file is corrupted (has an invalid or missing value), then the program stops its initialization at the point of the error. The data file should contain one DVD per line, with title followed by rating followed by running time in minutes, all separated by commas. You may assume titles are all in uppercase and do not contain commas. For example:

ANGELS AND DEMONS,PG-13,138

STAR TREK,R,127

UP,PG,96

The titles may not be in alphabetical order, but the DVDs should be inserted into the array in alphabetical order.

The application will then allow its user to perform the following operations:

ADD OR MODIFY DVD - The user will be prompted to enter the title, rating and running time (in minutes) for a DVD. If the title is already in the array, then the rating and running time are updated to the supplied values. If the title is not in the array, a DVD is added to the array so that the array is sorted by title. Convert all titles to uppercase only.

REMOVE DVD - The user will be prompted to enter the title of a DVD. If the title is in the array, then the DVD is removed, shifting subsequent DVDs over one position to fill in the gap left by the removed DVD. Again, titles must match exactly (in uppercase).

GET DVDs BY RATING - The user will be prompted to enter a movie rating (e.g. PG). This operation displays a string containing all DVDs matching the given rating in the order that they appear in the DVD collection, separated by newline characters.

GET TOTAL RUNNING TIME - This operation displays the total running time of all DVDs in the collection for the user.

SAVE & EXIT - The user can quit the program, performing an automatic save if the DVD collection has been modified.

Java Files

DVD.java - A class to model a single DVD, including its title, rating and total running time.

DVDCollection.java - A class to model a collection of DVDs using an array.

DVDUserInterface.java - An interface that describes the operation required for any user interface to this DVD collection.

DVDGUI.java - A class that implements the DVDUserInterface interface and provides a graphical user interface to the DVD collection.

DVDConsoleUI.java - A class that implements the DVDUserInterface interface and provides a console user interface to the DVD collection.

DVDManager.java - A class that contains a main method that launches one of the two user interfaces for the user to work with the DVD collection based on the user input.

Complete the DVD class by completing the given methods (constructor, accessors and mutators). Add javadoc comments so you can generate a javadoc documentation file showing how to use this class.

The DVDCollection class uses an array to maintain the collection of DVDs. The DVDs should be stored in alphabetical order based on title starting at position 0 in the array, using adjacent cells. All titles should be stored in uppercase only and are assumed to be unique (no duplicates).

toString - returns a string containing all of the DVDs in the collection, separated by newlines characters, along with the value of numdvds and the length of the DVD array for debugging purposes. The string should be formatted as shown in the example below:

numdvds = 3

dvdArray.length = 7

dvdArray[0] = ANGELS AND DEMONS/PG-13/138min

dvdArray[1] = STAR TREK/R/127min

dvdArray[2] = UP/PG/96min

addOrModifyDVD - given the title, rating and running time of a DVD, add this DVD to the collection if the title is not present in the DVD collection or modify the DVD's rating and running time if the title is present in the collection.insert the DVD so that all DVDs are in alphabetical order by title.

removeDVD - given the title, this method should remove the DVD with this title from the collection if present. The title must match exactly (in uppercase). If no title matches, do not change the collection.

getDVDsByRating - given the rating, this method should return a string containing all DVDs that match the given rating in the order that they appear in the collection, separated by newlines.

getTotalRunningTime - this method should return the total running time of all DVDs in the collection. If there are no DVDs in the collection, return 0.

loadData - given a file name, this method should try to open this file and read the DVD data contained inside to create an initial alphabetized DVD collection.

save - save the DVDs currently in the array into the same file specified during the load operation, overwriting whatever data was originally there.

You might be interested in
imagine that you wanted to write a program that asks the user to enter in 5 grade values. the user may or may not enter valid gr
Aloiza [94]

In a computer program, loops are used to perform repetitive operations until a condition is met.

The nested loop structure to use in this case is: <em>A "while" loop inside of a "for" loop</em>

<u>The outer loop</u>

First, you must iterate through each student.

This can be done using a for loop or a while loop.

However, it is faster to implement this kind of iteration on a for loop, than a while loop

So, the algorithm of the outer loop would look like the following:

<em>for student = 1 to 5 step 1</em>

<em />

<u />

<u>The inner loop</u>

Next, you must get input for the 5 grades for each student

After getting input for the grade of each student, a loop would be used to test if the input is valid.

The loop would be repeated until the user enters a valid input.

This can only be done using a while loop.

So, the algorithm of the inner loop would look like the following:

<em>input grade</em>

<em>while grade is invalid:</em>

<em>     input grade</em>

<em />

<em />

<em />

Hence, the nested loop structure to use is:

<em>A "while" loop inside of a "for" loop</em>

<em />

<em />

Read more about loops at:

brainly.com/question/11608024

7 0
3 years ago
What is an Algorithm? (might not be in the chapter text). Give an example.
Rashid [163]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

An algorithm is the list of a finite set of instructions and rules that a computer needs to do to complete a task in order to solve a problem.

In short, an algorithm is a series of instructions that are implemented step by step to solve a problem. For example, you could consider a pizza recipe an algorithm for making a pizza in an everyday life routine. But when you are talking about using algorithms in computation and in mathematics. It means that solving a problem using a series of steps step by step.

For example, your everyday tasks aligned on a google calendar and remind you about your tasks using the alarm, etc- how to implement this using set of instructions and rules- is an algorithm.

Solving a quadratic equation is another example of an algorithm.

Binary search, array sorting are an example of an algorithm in computation. Because these algorithms based on the execution of step-by-step instruction to solve a problem such as sorting a list of numbers etc.  

6 0
2 years ago
Among the many DTP software tools available today, which is regarded as the industry standard for DTP?
nexus9112 [7]

Answer:

bland1 InDesign    Blank2 typesetting

Explanation:

4 0
3 years ago
Read 2 more answers
By default the normal style inserts a vertical space equal to _____ lines between each line of text
nika2105 [10]
By default the normal style inserts a vertical space equal to 1.5 size vertical   lines between each line of text.
3 0
2 years ago
____________ refers to the computer-to-computer transmission of business data in a structured format.
motikmotik

Answer:

Electronic Data Interchange (EDI)

Explanation:

Electronic Data Interchange

It is the automated interchange of commercial information using a structured format. A process that allows a company to send information to another company electronically rather than on paper. Commercial entities that conduct business electronically are called business partners.

Numerous commercial documents can be exchanged using electronic data interchange, but the two most common are purchase orders and invoices. At a bottom, EDI interchanges the preparation and handling of mail associated with traditional commercial communication. However, the true power of EDI is that it standardizes the information communicated in commercial documents, which makes a "paperless" exchange possible.

6 0
3 years ago
Other questions:
  • Text, numbers,graphics, sounds entered into a computer's memory during input operations are referred to as
    11·1 answer
  • Write a loop that continually asks the user what pets the user has, until the user enters "rock", in which case the loop ends. I
    12·1 answer
  • Computer virus is a<br> a. software<br> b. hardware<br> c. bacteria<br> d. none of these
    13·1 answer
  • If your problem is caused by a bad hardware or software installation and you get an error message the first time you restart the
    6·1 answer
  • For each entity, select the attribute that could be the unique identifier of each entity.
    12·1 answer
  • Drugs of addiction act upon a portion of the Brain called the lambic system ? True or false.
    7·1 answer
  • The birthday problem is as follows: given a group of n people in a room, what is the probability that two or more of them have t
    15·1 answer
  • Write a program in python to make the figure:-
    12·1 answer
  • You are trying to sell a new product to a store owner. Which method of presentation
    10·1 answer
  • Create a program that prompts the user for a positive integer then prints a right-aligned pyramid using that number using the st
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!