Using modern C++, write a program which starts two threads. The first thread periodically generates a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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). 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).
Expert Answer:
Answer rating: 100% (QA)
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 the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these operating system questions
-
In two different countries of your choice, describe how insecure property rights affect natural resource management. For each country, discuss one example. Example 1 (10 points) Example 2 (10 points)
-
How do we solve labor problems? The government of the united states changes their position as regards the ever present conflict between labor and management. At one times, it tilts towards labor and...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Your friend has just started a retail clothing store in kamloops. She will be purchasing inventory to make her own clothing (One Style) and she will also be buying ready to sell iteams. She has come...
-
Why is the section devoted to reasons the most important part of a negative message, and which five factors ensure the effectiveness of the reasons given?
-
What were the schemes that Rite Aid used to inflate its profits?
-
Locate an expert in the area of products liability who resides in California. Are there websites that provide a directory of experts in California who can testify in civil litigation cases?
-
When is a companys competitive advantage most likely to endure over time?
-
What are Rare Earth Elements (REE)? 2) What products use REE? 3) What country produces the most REE? 4) Discuss the geo-political impacts of the current situation regarding REE. 5) Do you have any...
-
Department Bonus If the Dept is 6007, enter 900, if it is 4305, enter 600, if it is 4312, enter 350, otherwise enter 200. Copy the function down for the employees. Calculate the total Department...
-
Saddlery Company sells leather saddles and equipment for horse enthusiasts. Saddlery uses the perpetual inventory system. The following schedule relates to the company's inventory for the month of...
-
Entrepreneur David Tran cooked up his first batch of hot-pepper sauce in 1975, when he was still living in his native Vietnam. He packaged the sauce in recycled baby-food jars, and family members...
-
A merry-go-round rotates at the rate of 0.23 rev/s with an 100 kg man standing at a point 1.3 m from the axis of rotation. What is the new angular speed when the man walks to a point 0 m from the...
-
In the first section of this presentation, you will set the stage for an explanation of why marketing is valuable to an organization by doing the following: Explain what the marketing concept is and...
-
What role does intelligent transportation systems (ITS) play in improving urban traffic flow and reducing congestion? Discuss the challenges and potential benefits of implementing ITS in major...
-
4. Provide Trend analysis for the last 5 years for TESLA and determine 1-year projections for the key performance metrics below. (Include justifications for your projections). Turnover ratios Return...
-
What are the THREE key activities of the finance manager? Explain. The following table shows the income statement of TV Summit Corporation for the year ended 31 Dec 20X2. (i) Calculate the three...
-
The Ferris wheel in the figure has a radius of 68 feet. The clearance between the wheel and the ground is 14 feet. The rectangular coordinate system shown has its origin on the ground directly below...
-
Revise Listing 18.9 to develop a program that lets the user use the + and ? buttons to increase or decrease the current order by 1, as shown in Figure 18.12a. The initial order is 0. If the current...
-
Write a recursive method that displays a string reversely on the console using the following header: public static void reverseDisplay(String value) For example, reverseDisplay("abcd") displays dcba....
-
Write the methods with the following headers // Return the reversal of an integer, i.e., reverse(456) returns 654 public static int reverse(int number) // Return true if number is a palindrome public...
-
If the correlation coefficient is equal to 0, the slope of the least-squares regression line will be equal to _____________________ . In Exercises 57, fill in each blank with the appropriate word or...
-
In Exercises 1316, compute the least-squares regression line for the given data set. xy 1 2 3 5 5 6 9 7
-
In Exercises 1316, compute the least-squares regression line for the given data set. x 42 36 14 18 23 36 17 y 72 68 25 31 42 42 65 32
Study smarter with the SolutionInn App