Lab 5: Very Small Video, Int'l

Objectives

Description

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: Sample transcript of Very Small Video's database system

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 xcheckin
selcust x selvideo xcheckout
quit videos checkouts

Structure

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.
The template code defines the methods that you should define for each of these classes.

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.

  1. Write the code to support the first column of operations: addcust, selcust, and quit.

  2. Write the code to support the second column of operations: addvideo, selvideo, and videos.

  3. Write the code to support the final column of operations: checkin, checkout, and checkouts.