Starting from:

$30

CSE522-Assignment 4 Part 2 Design Patterns Solved

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.   .   A correct implementation would enable you to see the table, bar-chart, and pie-chart

More products