Professional Documents
Culture Documents
Object Oriented Programming Lab
Object Oriented Programming Lab
CSL 210
Lab Journal
Lab # 9
Objectives:
Tools Used:
Visual Studio
Submission Date:
Evaluation: Signatures of Lab Engineer:
Task # 1:
Write a program that defines a shape base class with a constructor that gives value to width and height. Then
define two derived classes triangle and rectangle, that calculate the area of the shape. In the main,
define two variables a triangle and a rectangle and then compute their area.
Procedure/Program:
Result/Output:
Task # 2:
Exercise 9.2 Write a class to represent a 2D point. Derive a class from it to represent a 3D point. Use objects of
the derived classes to find distance between two points
Procedure/Program:
Result/Output:
Task # 3:
Create a class called Employee whose objects are records for an employee. This class will be a derived class of
the base class Person. An employee record has an employee's name (inherited from the class Person),
an annual salary represented as a single value of type double, a year the employee started work as a
single value of type int and a national insurance number, which is a value of type String. Your class
should have a reasonable number of constructors and access functions, as well as a print function.
Write a driver to fully test your class definition.
Procedure/Program:
Result/Output: