Java Reference
In-Depth Information
Lab 4.1: The Video Rental Store
In this lab, you will design a solution to a problem that is to be solved
using an object-oriented programming language. You will use the con-
cepts of OOAD to determine the classes needed and what they look like.
(Keep in mind that there is no single correct solution to any programming
problem, as long as the program solves the problem at hand.)
Suppose that a program is to be written in Java to solve the following
problem: A video rental store wants a program to keep track of its
movies. It rents VHS and DVD movies, with each movie given a unique
inventory number. Each customer must have a phone number, which is
used as his or her membership number. The program needs to keep track
of every customer and every movie, including information such as
whether a movie is rented or available, who has it rented, and when it is
due back. Employees of the store receive a commission on sales of non-
movie items such as candy and popcorn, so this information needs to be
maintained as well.
1. Determine the objects in the problem domain.
2. For each object, determine its attributes and behaviors.
Lab 4.2: Writing Classes
In this lab, you will write a class for each of the classes you described in
Lab 4.1.
1.
Write a Java class for each of the classes you came up with in Lab
4.1. When writing your classes, keep the following in mind:
Each class you write should be public; therefore, each class needs
to appear in a separate source code file.
■■
We have not discussed the details of writing methods. (Methods
are discussed in the next chapter.) Focus on which methods each
class should have, but don't worry about how they should be
implemented. Within each method, use the System.out.println()
method to display the name of the method.
■■
Be sure to save all your classes in the same directory on your
hard drive.
■■
Search WWH ::




Custom Search