Question: Using modern C++, write a program which starts two threads. The first thread periodically generates a random number and adds it to the total.

Using modern C++, write a program which starts two threads. The first thread periodically generates a random

Using modern C++, write a program which starts two threads. The first thread periodically generates a random number and adds it to the total. The second thread periodically generates a random number and subtracts it from the total. The main thread periodically monitors the value of the total. If the total exceeds the maximum value, the program terminates and alerts the user that the maximum has been exceeded. If the total undercuts the minimum value, the program terminates and alerts the user that the minimum has been undercut. Requirements 1. The program should be configured at startup via a configuration file. Parameters that should be configurable are: . Minimum and maximum values for the random number generation Minimum and maximum values for the total Period for addition . Period for subtraction . Period for monitoring . 2. The program should follow Object-Oriented design practices. 3. Use only the Standard Template Library classes in your design (i.e.: no third party libraries such as Boost).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Creating a program like this involves several components such as threads random number generation and configuration file handling Below is an example of how you might structure such a program using mo... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Operating System Questions!