Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Scenario: A student has just been taught a design pattern known as the observer pattern. The student is tasked to produce a C# program comprising

Scenario:

A student has just been taught a design pattern known as the observer pattern. The student is tasked to produce a C# program comprising of the following:

A class known as Generator that will at random create a value of type integer within a scope of 1 to 1000 each time a user requests or requires a fresh value. This freshly created value needs to be passed automatically to 2 different type of objects (classes) namely:

Sum - The Sum is responsible for receiving the randomly created value and adding it to the previously created value (should there be no previous value, 0 should be used). Finally, the result should be displayed to the console window.

Date The Date is responsible for receiving the randomly created value and adding it to the current date as number of days. Finally, the date generated should be displayed to the console window.

The application is supposed to loop continuously up until the user pushes the e key on the keyboard to signal the end of the application.

During every loop iteration, the screen must be emptied, a fresh value created or generated and both Date and Sum values should display to the console window.

Since this application is based on the design pattern known as the observer pattern, all interfaces and methods used must support this specified pattern.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions

Question

Does it make clear how measurements are defined?

Answered: 1 week ago

Question

=+What is the most that you should pay to complete development?

Answered: 1 week ago