Homework 3 consists of developing a program that meets the requirements below while exhibiting good object-oriented design and submitting the assignment to me using the guidelines presented on slide 14 of lecture 1 . This homework is worth 50 points (30 points for your program and 20 points for the PDF document that describes it).
Problem Domain: Video Rental Store
For this homework, you will design an object-oriented program to model the following problem domain.
A video rental store has a catalog of 20 different videos to rent, spread across 5 different categories (New Release, Drama, Comedy, Romance, and Horror). Each video has a unique name and belongs to a specific category; the price per day to rent a video varies by category. New Release is, for example, the most expensive category. Comedy is the cheapest category.
Customers are allowed to rent a video for up to 7 nights. (Thus a video rented for 7 nights on a Monday must be returned by the following Monday. A video rented for "one day" woudl, for example, be rented on a Tuesday and returned the next morning before the video store opens for business on Wednesday.) Customers are allowed to have at most three videos rented at any one time.
This store has 10 customers; each customer has a unique name and is associated with one of three types. Breezy customers rent one or two videos for one or two nights. Hoarders always rent three videos for seven nights. Regular customers will rent one to three videos each time visit for 3 to 5 nights.
Each time a customer comes into the store, a Rental is created that will keep track of what videos they rented and how many nights they will keep the videos. A customer rents the "group" of vidoes and returns them all at the same time. They will NOT, for example, rent three videos and then return one after 2 days, the second after 5 days, and the third after seven days. They will instead return all of the videos they rented at the specified time. (That means, for instance, that a customer will never be late in returning their videos.)
The store keeps track of the existing rentals along with the current inventory of the store. As such, when it has zero rentals, there will be 20 videos in its inventory. When it has zero vidoes in its inventory, it will have multiple rentals that between them account for all 20 videos.
Finally, a customer pays up front for their rental. If, for example, a customer rents three Horror videos for three nights at a price of $3 per night, they will pay the store $27 dollars before they leave the store with their three videos.
Write an object-oriented program that implements the above problem domain and does the following:
- Simulates the activity of the video store for 35 days (34 nights). On each day, a random number of customers will visit the store as long as there are videos to rent. Each customer will create one Rental that follows the rules of their associated type before they leave the store. That is, no customer will show up and then leave without making a rental. Note: if the store has less than 3 videos, then a Hoarder will NOT arrive (as they wouldn't be able to create a Rental that follows their rules). As soon as the store has zero videos, customers will magically stop arriving until videos are once again available.
- At the end of the simluation, the program will produce a report that includes the following information:
- the number of videos currently in the store along with a list of their names
- the amount of money the store made during the 35 days (including any rentals that occured on the 35th day)
- a list of all the completed rentals including which movies were rented by which customer for how many days along with the total amount of that rental
- a list of all the active rentals that includes all of the information listed in the previous bullet
The purpose of this assignment is NOT to meet the requirements above by any means necessary. A program that does the simulation above and produces the requested report but makes use of structured programming techniques (i.e. no objects, just data structures and a main program) will receive zero points (for the whole assignment). An object-oriented program that meets the requirements but doesn't make use of polymorphism, has poor abstractions, and poor encapsulation will lose most of the 30 points allocated to the program. Only object-oriented programs that show good use of abstraction, encapsulation and polymorphism and meet the above requirements will be able to get full credit for the program.
You may use any object-oriented programming language to write these programs such as Java, C++, C#, Objective-C, ruby or python. If you're contemplating using a langauge other than the ones listed in the previous sentence, then check in with Prof. Anderson before you get too far into your development. For some languages, the grader may have to arrange to meet with you to see your programs in action. If so, he will contact you to set up a meeting.
Your submission will be an archive (i.e. a zip archive or compressed tar file) containing the source code for your program and a PDF document that describes your program and its design and that provides instructions on how to compile it and run it. The PDF document will also contain a UML class diagram that shows the classes that make up your program and the relationships that exist between them.
You will send this archive to Prof. Anderson as an attachment to an e-mail message or by uploading the attachment so that it is available on a web server (such as by placing it in the public_html directory of your CSEL account) and then sending Prof. Anderson an e-mail message that contains the URL that will let him download your archive.
Due Dates: Homework 3 is due by 11:59 PM on Friday, September 16, 2011. Any homework submitted after that time but by 11:59 PM on Friday, September 23, 2011 will be graded but will receive a 15% penalty. After that, submissions of Homework 3 will be ignored.
As always, you are encouraged to work in teams on this assignment. If you do, you will submit just one assignment for the entire team; that assignment will list the names of the team members at the top of the first page of the PDF document contained within the archive that you submit.
Send e-mail to Prof. Anderson.
Get started early on this assignment and come to Tuesday's lecture prepared with your questions. Heads Up: The day this assignment is due, Friday, September 16th, Prof. Anderson will be attending an all day workshop down in Denver with zero e-mail access for most of the day. As such, waiting for the last day to work on this assignment could prove very problematic.
- A customer can have more than one active rental. That is, they can show up on day 1 and rent 1 video for 5 nights. They can then show up on day 2 and rent another video for 4 nights. As long as they do not have more than 3 videos rented, they are allowed to have multiple rentals.
- Returns occur at the beginning of the day before the store opens for business. A video rented for one night is available to customers the very next day; that's because the customer rented the video for one night, watched it, and got it back to the store early the next morning.
- Your program should be single-threaded; you do not need to handle the case of multiple customers trying to rent videos concurrently.