Hands On Java: Project 11


 

Objectives

1. Practice designing and creating class hierarchies.
2. Familiarity with creating packages.

Introduction

Each of the following projects involves creating a class hierarchy. Your instructor will tell you which of them you are to do, and will provide any input files to be used to test your program.

Projects

11.1. Complete the subclasses InterestAccount and CDAccount.

Write a program that demonstrates the correctness of your implementation.

11.2. Design and build two new classes for the bank accounts hierarchy.

AutoPayAccount - Just like a checking account except it has a method which allows a user schedule bills to be paid automatically. This method should take three arguments: the name of the payee, the amount to pay, and the number of months between payments. For example, if the number of months between payments is 3, then the bill should be paid every three months.

ChristmasAccount - This account has no fees associated with it. It pays 20% interest. The user can make any number of deposits that they wish for up to eleven months. No withdrawals can be made until the twelfth month. After the twelfth month money can only be withdrawn and no interest will be paid.

Write a program that demonstrates the correctness of your implementation.

11.3. Design and build a class hierarchy for media types stored in a package. Your hierarchy should support Books, Periodicals, VideoTapes and CDs. Some attributes for these kinds of objects include: title, author, ISBN number, subject, running time, volume number, rating, and lending length.

Store the hierarchy in a package and then write a program that creates an array of media types and uses that to demonstrate the correctness of your design and implementation.

11.4. Design and build a class hierarchy for shapes. Your hierarchy should support circles, ovals, triangles, right triangles, squares, rectangles, quadrilaterals. Each class should have appropriate attributes in order to be able to determine: the smallest rectangle that bounds the shape, the area of the shape, the circumference of the shape, whether a point is inside the shape, and whether two shapes bounding rectangles intersect.

Store the hierarchy in a package and then write a program that creates an array of shape types and uses that to demonstrate the correctness of your design and implementation.

Turn In: A hard copy of this grade sheet, attached to hard copies of

  1. all source files you created for this project;
  2. an execution record showing a run of your program;
  3. the input file from the run of your program; and
  4. the output file from the execution of your program (if appropriate).

Don't forget to clean up your directory when you are all finished...


Back to the Lab Table of Contents

Back to the Lab Exercise


Back to the Table of Contents

Back to the Introduction


Copyright 2000 by Prentice Hall. All rights reserved.