previous next

Computer Science for Transfers
Lab 2 - Introduction to Inheritance

You may download the .jar file for this week's lab by typing this command at the Unix prompt:

    cp ~csx/public_html/lab2.jar .
Notice the command ends with jar SPACE DOT

Overview

The primary purpose of this lab is to give you first hand experience developing classes using inheritance. You will work with two different class hierarchies. In both, you will use an abstract class to create several new classes and then write a simple program that uses polymorphism.

Ask Dr. Tiger

Pre-Lab Activities

  1. Read chapter 3 and review your class notes.
  2. Read the document An Introduction to RCS.
  3. Read the Unix® manual pages for RCS, and the RCS ci and co commands.

    Note: Some parts of the manual pages will not make much sense to you, but most of it should. You want to become familiar with not only these particular commands, but with manual pages in general: the kinds of information they contain, the order and manner in which it is presented, etc.

  4. Complete the exercises found by clicking here.

Objectives

  1. Use a Version Control System.
  2. Identify abstract classes and inheritance relationships.
  3. Create a hierarchy of classes representing phone bills.
  4. Create a hierarchy of classes representing bank accounts.
  5. Learn how to use Object's toString() method.
  6. Use polymorphism in a simple program.

Activities

  1. RCS
  2. Writing a phone bill hierarchy of classes
  3. Writing subclasses for a BankAccount
  4. Polymorphism in action

Grading

In-lab participation 3
Lab Activity 1 4
Lab Activity 2 7
Lab Activity 3 7
Lab Activity 4 9
Total 30 points

previous next
Rev. 9/11/2012 by tmh to add jar copy command
Modified July 24, 2012 10:50:34 AM by tmh, © by csfac@RIT. All rights reserved.