CS 110: Introduction
to Computing with Java
the following tasks before coming to lab.
You will not be able to work on the lab if you have not already
completed these tasks.
Read the description of the lab. Notice that you will be writing a NewReleasePrice class with several methods. Write
the name of the methods you need to implement in this class.
In this lab, you will complete the
implementation of a Movie Rental application that can be used by a video store
to calculate and print a customer’s bill. The video store clerk tells the
application which movies a customer rented and for how long. The application
calculates the charges and frequent renter points, which depend on the type of
movie and how long the movie is rented. There are three kinds of movies:
Regular, Children’s and New Releases. Customer’s charges and frequent renter
points are calculated according to the following table:
Frequent Renter Points
$2.00 for the first 2 days rental plus $1.50 each additional day.
$1.50 for the first 3 days rental plus $1.50 each additional
$3.00 for each days rental
rented > 1 then 2 otherwise 1
lab gives you some experience working with the Class inheritance, polymorphism
and abstract classes.
Copy the project. A nearly complete set of Java files for the
video store application can be found in lab8.zip. Extract these files to folder of your
choosing on the student drive. As usual,
open Dr Java and create a new project including the Java files you just
Look at the code. You will be writing a class NewReleasePrice class that extends Price
class. Look at the current sub-classes
of Price class. Discuss with
your partner and TA what your class will need to do.
Run the tests. For your convenience, we have built TestCustomer class to help you know when you have completed your class
successfully. Run the tests now.
Write the NewReleasePrice
class. Remember to keep running the unit tests until they
succeed. (Is your code necessarily
correct when the unit tests succeed?).
Add a case for NEW_RELEASE to the switch statement in the Movie class.
class. Your sample output should look
like what follows.
should see the following when you run the Customer
you leave, have your TA check off that you completed the lab. Make sure each person saves a copy of your
a document describing your experiences.
Your lab must be printed (not
the following questions related to what you did in this week’s lab. You may complete the code on your own, but
the TA must certify that most of your work was done in the lab.
Answer each of the following
questions about the application:
Why did the author of the
software decide to create a Price
class and its sub classes: RegularPrice
instead of creating subclasses RegularMovie
of the Movie class.
Notice that the author of the Price class has chosen to make the getCharges method abstract and provided implementation for the getFrequentRenterPoints method. Why do you think this is a
Describe what you learned
doing this lab. Explain what was
difficult and what was easy.
Attach a listing of your
completed NewReleasePrice and
Note: You should work alone on writing the lab
Note: The assignment is due
at the BEGINNING of your next lab. No
late assignments will be accepted.
Emailed assignments will not be accepted. If you are not going to be in lab on the due
date, you can turn the assignment ahead of time to the CS110 TA box in the CS