Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Against the advice of everyone you know, you decide to open up a DVD rental store! Requirements: To run a successful store you must: Store

Against the advice of everyone you know, you decide to open up a DVD rental store!

Requirements:

To run a successful store you must:

Store information about your Customers.

Store information about your available Movies.

Maintain a mapping of which movies each customer currently is renting.

Step 1: Your Customer class.

Create a Customer class that stores a Customer ID, First Name, Last Name, and Account Balance.

Override toString(), equals(), and hashCode() as discussed in class. Customer ID is sufficient to uniquely identify a Customer.

Create all constructors, getters, setters as necessary

Step 2: Your Movie class

Create a Movie class that stores a Movie Title and Copies Remaining

Override toString(), equals(), and hashCode() as discussed in class. Movie Title is sufficient to uniquely identify a Movie.

Create all constructors, getters, setters as necessary

Step 3: Your Video Store class

This class is central to your application. Create a VideoStore class that contains your Store Name, as well as:

A Set containing your movies

A Set containing your customers

A Map specifying which customers have rented which movies

Create the following methods in your VideoStore class:

- addMovie() : Adds a movie to your available titles. It should take the movie title and number of available copies as parameters.

- updateMovie() : Updates a movie in your system. It should take the movie title and number of available copies as parameters.

- addCustomer() : Adds a customer to your system. It should take the customers Customer ID, First Name, Last Name, and Account Balance as parameters.

- updateCustomer() : Updates a customer to your system. It should take the customers Customer ID, First Name, Last Name, and Account Balance as parameters.

- addRental(): Records the fact that a customer has rented a movie. It should take the Customer ID and the movie title they would like to rent as parameters. It should verify that the movie is available (in the system, and having number of copies > 0), and that the customer is in the system. If these verifications pass, it should record the fact that the movie has been rented in the Map, decrement the number of copies of that movie are available, and return true. If these verifications fail, it should provide a useful message and return false.

- showAll(): Displays all Movies, Customers, and Rentals in a nicely formatted manner using Iterators as described in class.

Step 4: Your main() method

In your main method:

Create an instance of your VideoStore class.

Use the addMovie() method to add 3 movies to the system

Use the updateMovie() method to update a movie to the system

Use the addCustomer() method to add 2 customers to the system

Use the updateCustomer() method to update a customer to the system

Use the addRental() method to make a single customer rent at least two different movies

Use the showAll() method to show the status of your video store

Step 5: Create a UML Class diagram for all of your classes.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

ISBN: 0619064625, 978-0619064624

More Books

Students also viewed these Databases questions

Question

Will pasta cook faster if the water boils more vigorously? Explain.

Answered: 1 week ago