Write a multithreaded program to estimate the PI value using the Leibniz Series shown below. (1)...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a multithreaded program to estimate the PI value using the Leibniz Series shown below. (1) (2) 74 [[म = 1 || 8WI 1 3 + 1 (-1)* 2k + 1 - 1 1 + 7 9 ≈ 0-78539 81633 9744... You are asked to compute the first 500,000,000 terms of the series using the Fork-Join Framework. Each subtask should compute no more than 10,000 terms. Name your main class Leibniz PiEstimator and declare it in the package s2223.test2.student. Your program should measure the running time and the absolute difference between Math.PI and the approximated Pl value. You should print out the result as shown below. Output - Exam (run) run: This multithreaded program approximates PI using Leibniz series. Computed PI = 3.141592651589786, Difference = 2.0000072709080996E-9 Running Time (ms): 5749 BUILD SUCCESSFUL (total time: 5 seconds) A video content provider logs the clients' streaming requests daily. The streaming requests are stored in a file (video_data.txt) with one client request per line. Each line contains the following three fields separated by commas: • timestamp • video ID client's IP address Write a Java program to find the top 5 most active clients in the log file, i.e., the five IP addresses with the highest view count. A program template of the main class (LogAnalyzer) is provided to you. You need to implement the methods readDataFile() and findTop5Clients () in the main class. The specification of the methods is written and explained in the comment section. The expected program output is as follows: Output - Exam (run) % run: Top 5 active clients (client IP, view count): (207.146.146.159, 17) (206.141.157.150, 13) (201.162.145.140, 8) DD IDD (204.143.182.132, 7) (209.165.156.160, 2) BUILD SUCCESSFUL (total time: 0 seconds) Write a multithreaded program to estimate the PI value using the Leibniz Series shown below. (1) (2) 74 [[म = 1 || 8WI 1 3 + 1 (-1)* 2k + 1 - 1 1 + 7 9 ≈ 0-78539 81633 9744... You are asked to compute the first 500,000,000 terms of the series using the Fork-Join Framework. Each subtask should compute no more than 10,000 terms. Name your main class Leibniz PiEstimator and declare it in the package s2223.test2.student. Your program should measure the running time and the absolute difference between Math.PI and the approximated Pl value. You should print out the result as shown below. Output - Exam (run) run: This multithreaded program approximates PI using Leibniz series. Computed PI = 3.141592651589786, Difference = 2.0000072709080996E-9 Running Time (ms): 5749 BUILD SUCCESSFUL (total time: 5 seconds) A video content provider logs the clients' streaming requests daily. The streaming requests are stored in a file (video_data.txt) with one client request per line. Each line contains the following three fields separated by commas: • timestamp • video ID client's IP address Write a Java program to find the top 5 most active clients in the log file, i.e., the five IP addresses with the highest view count. A program template of the main class (LogAnalyzer) is provided to you. You need to implement the methods readDataFile() and findTop5Clients () in the main class. The specification of the methods is written and explained in the comment section. The expected program output is as follows: Output - Exam (run) % run: Top 5 active clients (client IP, view count): (207.146.146.159, 17) (206.141.157.150, 13) (201.162.145.140, 8) DD IDD (204.143.182.132, 7) (209.165.156.160, 2) BUILD SUCCESSFUL (total time: 0 seconds)
Expert Answer:
Answer rating: 100% (QA)
Question 1 To estimate the P value using the Leibniz series for pi4 we can create a multithreaded pr... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
you are required to perform database table normalisation and present your solutions in a PowerPoint presentation. In doing so, you are required to demonstrate your work and solution through a series...
-
What am I required to do in this assignment? Shared Power is an information system to help tradesmen share expensive and specialist tools rather than buying them themselves. Registered owners add...
-
Our model of pollution in this chapter assumed that emissions are a pure private bad, and that people have no ability to protect themselves from the adverse consequences of exposure. In reality,...
-
Determine the temperature at the four nodes shown in the figure. Assume steady conditions and two-dimensional heat conduction. The four faces of the square shape are each at different temperatures as...
-
Complete the payroll register of C Stream for the week ended 16 September 2022 from figure 14.6. All employees ordinarily work 38 hours per week, and have had their hours approved and have sufficient...
-
A company wishes to hedge its exposure to a new fuel whose price changes have a 0.6 correlation with gasoline futures price changes. The company will lose $1 million for each 1 cent increase in the...
-
Clapton Company manufactures custom guitars in a wide variety of styles. The following incomplete ledger accounts refer to transactions that are summarized for May: In addition, the following...
-
I am facing a Database connection error (2). Could not connect to MySQL. error. Source codes are: Database Error Error establishing a database connection. Database connection error (2). Could not...
-
Salmon Limited reported profit of $465,325 for its November 30, 2021, year end. Cash dividends of $90,000 on the common shares and $65,000 on the noncumulative preferred shares were declared and paid...
-
Write a single Python expression to remove all spaces from a string s and reverse the order of words. Example: for s= 'I Code In Python', the result will be 'PythonInCodeI' Hints: If the string was...
-
Discuss how you plan to staff the project, include discussion on matrixed or projectized organizational structure depending on which is being used for this project. This section should also include...
-
Identify and discuss the primary alternatives for entrepreneurs in acquisition decisions. Based on the case study, provide an analysis of the two decisions taken by the entrepreneur in this regard,...
-
A stretched string is 2.11 m long and has a mass of 19.9 g. When the string oscillates at 440 Hz, which is the frequency of the standard A pitch, transverse waves with a wavelength of 16.7 cm travel...
-
During August, Diga Corporation plans to serve 44,000 customers. The company uses the following revenue and cost formulas in its budgeting, where q is the number of customers served: Revenue: $4.38q...
-
The following information is available for a company, Hawken Ltd. Beta = 0.8 Market Risk Premium (MRP) = 8% Risk free rate = 3.6% Terminal growth rate (g)-5% After tax cost of debt = 5% Corporate tax...
-
Use the graph of y=f(x) shown to the right to graph the following function g. 9(x)= -3 Choose the correct graph below. OA OB. C O C. Q ou Q G OD.
-
Reichenbach Co., organized in 2018, has set up a single account for all intangible assets. The following summary discloses the debit entries that have been recorded during 2018 and 2019. Instructions...
-
Mike purchases a heavy-duty truck (5-year class recovery property) for his delivery service on April 30, 2012. The truck is not considered a passenger automobile for purposes of the listed property...
-
Mark owns his home and has a $250,000 mortgage related to his purchase of the residence. When his daughter went to college in the fall of 2012, he borrowed $20,000 through a home equity loan on his...
-
Deborah purchases a new $30,000 car in 2012 to use exclusively in her business. If Deborah does not elect to expense or take bonus depreciation in 2012 and holds the car until it is fully...
-
The truss shown in figure 1.30 has two elements. The members are made of the aluminum hollow square cross section. The outer dimension of the square is \(12 \mathrm{~mm}\), and the inner dimension is...
-
Solve the onedimensional heat conduction problem 6 using the RayleighRitz method. For the heat conduction problem, the total potential can be defined as Use the approximate solution...
-
Consider a system of rigid bodies connected by springs as shown in figure 2.20. The bodies are assumed to move only in the horizontal direction. Further, we consider only the static problem, and...
Study smarter with the SolutionInn App