0% found this document useful (0 votes)
81 views2 pages

OOP Inheritance Lab Exercise

This document provides instructions for a lab exercise on inheritance. It includes UML diagrams that define classes for Person, Staff, Student, Circle, and Cylinder with their attributes and methods. The exercise asks students to create class definitions and applications based on the provided UML diagrams.

Uploaded by

shahrulkamil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views2 pages

OOP Inheritance Lab Exercise

This document provides instructions for a lab exercise on inheritance. It includes UML diagrams that define classes for Person, Staff, Student, Circle, and Cylinder with their attributes and methods. The exercise asks students to create class definitions and applications based on the provided UML diagrams.

Uploaded by

shahrulkamil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Lab Exercise

Inheritance
Create class definition and class application as the following UML diagram below:
1.























Person
- name : String
- icNumber : String
- homeAddress : String
- phoneNumber : String
+ Person()
+ Person(String n, String i, String h, String p)
+ setPerson(String n, String i, String h, String p) : void
+ getName() : double
+ getIcNumber() : String
+ getHomeAddress() : String
+ getPhoneNumber : String
+ toString() : String


Staff
- department
- roomNumber
- officeNumber
- salary
+ Staff()
+ Staff(..)
+ setStaff()
+ getDepartment()
+ getRoomNumber()
+ getOfficeNumber()
+ getSalary()
+ calcSalary()
+ toString()


Student
- program
- collegeAddress
- fee
- CGPA
+ Student()
+ Student(..)
+ setStudent()
+ getProgram()
+ getCollegeAddress()
+ getFee()
+ getCGPA()
+ calcFee()
+ toString()


2.










Circle
- Radius : double
- Pie : double
+ Circle()
+ Circle(double r)
+ setRadius() : void
+ getRadius() : double
+ area() : double
+ toString() : String


Cylinder
- Height : double
+ Cylinder()
+ Cylinder(double r, double h)
+ setHeight() : void
+ getHeight() : double
+ area() : double
+ volume() : double
+ toString() : String

You might also like