You are on page 1of 1

COMSATS-Lancaster Dual Degree Programme

Lancaster Block, CIIT, Defence Road, Off Raiwind Road, Lahore

Object Oriented Concepts and Programming (CSC 244)


Total Marks: 10 Mode of Submission: Hard copy (ONLY) Date of Submission: 26th Apr, 2012 (Late submission is not allowed)

Assignment 2
1. Create an abstract base class, Ball. The single constructor requires a String to indicate the type of ball, which then is stored in an instance variable. The instance method getType(), returns a new String containing the type of ball. The class declares an abstract method play () which returns void. 2. Create an abstract class Bounceable which inherits from Ball. Bounceable has a single abstract method, bounce () which returns a String. There are no instance variables. 3. Create two concrete classes Baseball and Bowlingball which inherit from Ball. No instance variables or additional methods are required. Only implementation of any inherited abstract methods is required. 4. Create two concrete classes Tennisball and Basketball which inherit from Bounceable. No instance variables or additonal methods are required. Only implementation of any inherited abstract methods is required. 5. Create a PolyTest class with main that must use above mentioned classes and methods. 6. Draw class diagram for above.

Note: Comment your program appropriately. Use lower case camel, naming convention.

By: Dr Tabbasum Naz

Date: 19th Apr, 2012

Page 1

You might also like