1. An important technique in the study of Object-Oriented Languages is the use of `delegation’ to
replace `class inheritance’. A systematic way for doing this transformation was given in Lecture 8.
Apply this technique to the program in Delegation.java located at Piazza Resources
Homeworks. This program defines four classes, A, B, C, and D where the classes C and D
extend class B which in turn extends class A. The result of your transformation should be four
classes called A2, B2, C2, and D2 which correspond to A, B, C, and D respectively, but do not make
use of class inheritance.
As outlined in Lecture 8, in order to develop the transformation, you need to define interfaces IA,
IB, IC, and ID, where the interfaces IC and ID extend IB which in turn extends IA. The classes A2,
B2, C2, and D2 implement interfaces IA, IB, IC, and ID respectively.
The file Delegation.java contains the definitions of classes A, B, C, and D and also a driver
class called Delegation. Place the interfaces IA, IB, IC, and ID and the classes A2, B2, C2, and D2
in the same file. Run the program through JIVE and save the sequence diagram in
Delegation.png.
Important: Full credit will be given only if the transformation is done in a systematic way.
2. Refer to program TreeGUIBasic.java located at Resources Homeworks on Piazza.
This program embodies a number of design patterns that we have studied in class.
(a) Mention all the design patterns present in the program.
(b) For each design pattern that is present in program, cite the specific code fragment that
illustrates the pattern.
Prepare a PDF file, called DesignPatterns.pdf, containing your answer and submit it along
with the files for problem 1.
What to Submit: Prepare a top-level directory named A2_UBITId1_UBITId2 if the assignment is
done by two students; otherwise, name it as A2_UBITId if the assignment is done solo. (Order the
UBITId’s in alphabetic order, in the former case.) In this directory, place Delegation.java,
Delegation.png and DesignPatterns.pdf.
Compress the directory and submit the resulting compressed file using the submit_cse505
command. For more details regarding online submission, see Resources Homeworks
Assignment, CSE505, Languages, object, Oriented, solved
[SOLVED] Cse505 assignment # 2 – object oriented languages
$25
File Name: Cse505_assignment___2_____object_oriented_languages.zip
File Size: 480.42 KB
Reviews
There are no reviews yet.