Question: You have recently learnt about a design pattern called the Observer pattern. For this scenario you are required to create an application which contains the

You have recently learnt about a design pattern called the Observer pattern. For this scenario you are required to create an application which contains the following: A class called Generator, which randomly generates an integer value in the range 1 to 10000 whenever the user requests a new value. This newly generated value must be automatically passed to two different types of objects (classes): Sum: it should receive the randomly generated value, add it to the previously generated value (if no previous value exists use 0) and then display the result to the console window. o Date: It should receive the randomly generated value, add it to the current date as a number of days and display the generated date to the console window. The program should continuously loop until the user presses the "e" key to end the program. At each iteration of the loop the screen should be cleared, a new random velue generated, and the Sum and Dale values cisplayed on the console window. program should be based on the observer pattern, which means it should include all of the interfaces and methods required to align to this pattern. You have recently learnt about a design pattern called the Observer pattern. For this scenario you are required to create an application which contains the following: A class called Generator, which randomly generates an integer value in the range 1 to 10000 whenever the user requests a new value. This newly generated value must be automatically passed to two different types of objects (classes): Sum: it should receive the randomly generated value, add it to the previously generated value (if no previous value exists use 0) and then display the result to the console window. o Date: It should receive the randomly generated value, add it to the current date as a number of days and display the generated date to the console window. The program should continuously loop until the user presses the "e" key to end the program. At each iteration of the loop the screen should be cleared, a new random velue generated, and the Sum and Dale values cisplayed on the console window. program should be based on the observer pattern, which means it should include all of the interfaces and methods required to align to this pattern
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
