Assignment 4 Part 2: Design Patterns

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (2 votes)

Assignment 4
Part 2: Design Patterns
One of the most important design patterns is the Observer pattern, also known as the Model-ViewController (MVC) pattern, first introduced in the Smalltalk programming language. In this part of the
assignment, you are asked to make use of the Observer pattern so as to achieve a modular interaction
between a model and its viewers.
Posted on Piazza: ResourcesAssignments is a file ObserverPatternExample.java which
defines the following classes:
1. The “observer” classes Table, BarChart, and PieChart. The classes BarChart and
PieChart extend a class Chart, which factors the commonalities between these two classes.
The code for these classes is given to you in their entirety except for their respective update()
methods.
2. The “observable” class Sales, which records and updates sales data for five regions, called North,
South, Central, East, and West. The class is given in its entirety except for the code that notifies
the observers.
3. The class ObserverPatternExample is the top-level class containing the main() method.
You are required to define the main method fully.
Complete the definitions of the above classes and run the program. The amount of coding is very
small and much of it is similar to what was presented in Lecture 18. A correct implementation would
enable you to see the table, bar-chart, and pie-chart.
What to Submit. Prepare a top-level directory named A4_Part2_UBITId1_UBITId2 if the assignment is
done by a team of two students; otherwise, name it as A4_Part2_UBITId if the assignment is done
solo. (Order the UBITIds in alphabetic order, in the former case.) In this directory, place your
completed ObserverPatternExample.java. Compress the directory and submit the compressed
file using the submit_cse522 command. Only one submission per team is required.
End of Assignment 4 – Part 2