Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Polymorphism is not used in the following design. Explain how you would revise t

ID: 3805105 • Letter: P

Question

Polymorphism is not used in the following design. Explain how you would revise the class diagram so polymorphism is used. No need to draw the diagram, just explain in text.

ODU issues two types of parking permits ---the student permit and the faculty/staff permit. Both types of permits specify the permit ID, issue date and cost.

The student permit also specifies the permit type (e.g., commuter, evening, residential, etc.), and the semester (e.g., Fall 2017). The faculty/staff permit specifies the group of faculty/staff (e.g, group 1, group 2…, hourly employee, adjunct, etc.) and the academic year (e.g., year 2017/2018).The process of issuing the two types of permits are different. For example, the student’s registration status is checked before issuing a student permit, while payroll deduction is set up before issuing a faculty/staff permit.

Parking permit -+ID +Issue Date +Cost Student Parking +Type +Semester +I 88 estudent Permit +CheckRegistration FacultyStaff Parking +Group Year +I 88 Parking

Explanation / Answer

Polymorphism is a feature of object oriented programming.
Polymorphism means one name ,many forms.
Converting class diagrams to polymorphism


Base class or Parent class Parking permit
-----------------------------------------------------------------------
Parking permit                                                                |
+ID                                                                                 |
+IssueDate                                                                    |
+Cost                                                                            |
Parking permit(ID : int, Issue Date : Date , cost :double):|
--------------------------------------------------------------------

Student Parking that is a child class of Parking permit
that takes ID, issueDate and cost and pass them to the base class
in constructor calling to use parking permit class.
------------------------------------------------------------------------------
Student Parking                                                                       |
+Type                                                                                      |
+Semister                                                                                |
+Student Parking(ID : int, Issue Date : Date , cost :double,   |
Type: string, Semister: string ):                                               |
base(ID,IssueDate,cost)                                                         |
-----------------------------------------------------------------------------
+IssudeStudentPermit()
+CheckRegistration()

FacultyStaffParking that is a child class of Parking permit
that takes ID, issueDate and cost and pass them to the base class
in constructor calling to use parking permit class.

-----------------------------------------------------------------------------------
FacultyStaffParking                                                                       |
+Group                                                                                          |
+Year                                                                                             |
+FacultyStaffParking (ID : int, Issue Date : Date , cost :double,   |
Group: string, Year: string):                                                          |
base(ID,IssueDate,cost)                                                               |
+IssueFSParking()                                                                       |
--------------------------------------------------------------------------------

From the above classes, we can use polymorphism
feature "IS A "relation that Student Parking and FacultyStaffParking
classes.
Now, An object of Student Parking can be created using the Parking permit
by passing the base class member values from the child class constructor.