Sei sulla pagina 1di 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

Potrebbero piacerti anche