0% found this document useful (1 vote)
286 views2 pages

Object-Oriented Programming Lab Exercises

The document provides instructions for an object-oriented programming lab session involving inheritance and polymorphism exercises. Students are asked to: 1) Implement a class hierarchy for shapes with abstract and concrete classes, allowing for drawing and area calculation of different shapes. 2) Create classes to represent triangles and points. 3) Model persons, students, and staff using inheritance. 4) Design 2D and 3D point classes. The document links to Oracle and TutorialsPoint references on object-oriented concepts and includes details of four exercises to be implemented with testing code.

Uploaded by

Văn Nguyễn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
286 views2 pages

Object-Oriented Programming Lab Exercises

The document provides instructions for an object-oriented programming lab session involving inheritance and polymorphism exercises. Students are asked to: 1) Implement a class hierarchy for shapes with abstract and concrete classes, allowing for drawing and area calculation of different shapes. 2) Create classes to represent triangles and points. 3) Model persons, students, and staff using inheritance. 4) Design 2D and 3D point classes. The document links to Oracle and TutorialsPoint references on object-oriented concepts and includes details of four exercises to be implemented with testing code.

Uploaded by

Văn Nguyễn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Object-Oriented Programming

Lab Session #3

I. References
- Oracle Java Documentation: [Link]
- Inheritance in Java Tutorial: [Link]

II. Exercises
You are required to implement the following design as well as a main() method in a another class
to test your implementation:

1. Shapes (25 points)


Implement the hierarchy below where
- MyShape is an abstract class with an abstract Draw method,
- MyBoundedShape is an abstract class with an abstract GetArea method,
- MyLine, MyOval, MyRectangle are concrete classes

In the main() method,


- Ask user to select 5 shapes and input their dimension
- Draw selected shapes
- Compute and show area of selected shapes if they are a bounded shape

2. Triangle and Point (25 points)

3. Person, Student & Staff (25 points)


4. Point2D and Point3D (25 points)

You might also like