Very Small Video, International, Collegeville's hottest video rental store, has contracted you to develop a system for tracking their inventory. This system should track videos, customers, and the videos that customers check out.
Welcome to Very Small Video, International! Current video: none selected Current customer: none selected What to do? addvideo Mary_Poppins Current video: Mary_Poppins Current customer: none selected What to do? addvideo High_Noon Current video: Mary_Poppins Current customer: none selected What to do? addcust Robin Current video: High_Noon Current customer: Robin What to do? selvideo The_Matrix We don't have The_Matrix. Current video: High_Noon Current customer: Robin What to do? selvideo Mary_Poppins Current video: Mary_Poppins Current customer: Robin What to do? checkout Current video: Mary_Poppins Current customer: Robin What to do? checkouts Robin has checked out: Mary_Poppins Current video: Mary_Poppins Current customer: Robin What to do? videos Current videos: Mary_Poppins (checked out) High_Noon (available) Current video: Mary_Poppins Current customer: Robin What to do? quit |
Figure 5.1 gives you an idea of what the system will look like. As the program proceeds, it tracks the most recently accessed video and customer. The program should support the following nine operations.
addcust x | addvideo x | checkin |
selcust x | selvideo x | checkout |
quit | videos | checkouts |
Run getcs to get template code for this lab. Your program will be structured into four classes.
Main | Contains the main() class method. |
Store | Represents a store, holding both videos and customers. |
Video | Represents a single video. (I've done this for you already.) |
Customer | Represents a single customer. |
Many of the methods will throw an exception in the event of failure. For example, the addCustomer() method of Store would throw an exception if the array of customers is already full. You should attach the error message to the exception when it is created, so that main() can display a message describing the particulars of the error once it catches the exception.
I recommend that you complete the assignment in three steps, each time testing the portion you've completed thus far. I've annotated the comments within the classes telling in which step you should write that method.