CSC-133 (Fall 2018) Attendance Quiz 1 - OOP Concepts and UML Class Diagram
CSC-133 (Fall 2018) Attendance Quiz 1 - OOP Concepts and UML Class Diagram
CSC-133 (Fall 2018) Attendance Quiz 1 - OOP Concepts and UML Class Diagram
Question 1: Define encapsulation, abstraction. Explain how these two concepts relate to object-
oriented programming (OOP) (10 points).
Encapsulation: the bundling of data between methods that operate using the same data;
used for protection of data.
Both of these concepts aim to reduce redundancy and help organize programs.
Question 2: UML is not just about pretty pictures. If used correctly, UML precisely conveys how code
should be implemented from diagrams. If precisely interpreted, the implemented code will correctly
reflect the intent of the designer. Please review the following slides. In the class diagram in slide 24,
given the labels 1, 2, 3, 4, and 5 please fill out the required information in the table beneath. BE SURE
TO JUSTIFY YOUR ANSWER. (10 points).
Label Name the Justifications Specify Java Class(es) Name and
Number association (Please use the “Recap 1” Table Line of codes
for reference)
Aggregation Main panel “has a” relationship main class: Main Panel
with ‘point’ and creates at least private arrayList<Point> myPoint
1 ‘point’. Point is used in the
methods of main panel.
Dependency Main Panel and Display are main class: Main Panel
dependent upon one another constructor: myDisplayPanel =
because Main Panel could not be new DisplayPanel();
created without Display Panel;
Since the class “DisplayPanel” main class: Display Panel
also contains the constructor constructor: myMainPanel =
creating MainPanel, DisplayPanel theMainPanel
would be destroyed should
MainPanel not be created
Aggregation Main Panel is initialize in ‘display main class: Display Panel
panel’ which is required for the constructor: myMainPanel =
program to operate. theMainPanel