tut05_2009_r1 - EE3206/EE5805 Java Programming &...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
EE3206/EE5805 Java Programming & Applications Tutorial 5 – Generic Programming Before attempting the following questions, add the library file jtutor05lib.zip to the Libraries node of your project. 1. No matter abstract class or interface, both of them make use of abstract method to enforce protocol for communication between objects. An interface StackInterface is defined for a stack data structure and is documented in the link below. Its class file can be found from the given library. You are asked to write a class Stack that implements the interface. Use the client program TestStack in Code 1 to test your implementation. Javadoc - http://eda.ee.cityu.edu.hk/~cwting/course/ee3206/javadoc/ 2. Given the abstract class Shape , as shown in Code 2, write other three classes Circle , Rectangle and RegularPolygon to extend Shape . You should implement all abstract methods inheriting from Shape and provide constructors and getters for all data fields accordingly. The area of a regular polygon can be calculated by:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/20/2010 for the course ELECTRONIC EE3206 taught by Professor Tingchiwang during the Spring '10 term at École Normale Supérieure.

Page1 / 3

tut05_2009_r1 - EE3206/EE5805 Java Programming &...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online