Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Misr International University

Course Code & Title: SWE211 - Object Oriented Programming


Semester: Fall 2022
Instructor: Dr. Walaa Hassan
TAs: Eng. Maha Sayed
Eng. Nour Elhuda Ashraf
Eng. Youssef Talaat
__________________________________________________________________________________________

Lab 4
1. Draw the UML Class Diagram for the following class:

1
2. Implement the following UML Class Diagram with the given description:

3. State and describe each relationship in the following UML Class Diagram:

2
4. When a subclass inherits a superclass, does it inherit its constructors also? How do you tell
that when a subclass’s object is created the superclass’s constructor is invoked or not?
Write the code to prove it.
5. Create a Class called GeometricShape that has shapeName and two functions
calculatePerimeter and calculateArea. Create 3 more Classes; Square that has sideLength,
Rectangle that has length and width, and Circle that has radius. Each of these 3 Classes has
calculatePerimeter and CalculateArea. Design these 4 Classes and implement them, then
create an array of type GeometricShape in the main and initialize it with objects of
different types and then call the two methods calculatePerimeter and calculateArea for
each object.

You might also like