首页 > > 详细

EE5805讲解、Java程序设计调试、Java语言辅导、Network Programming讲解 解析Haskell程序|辅导留学生Pr

EE5805 Java Network Programming
Test 2, 2019/20 Summer Term
Question 1. (30 marks)
Write a multithreaded program to estimate the PI value using the Euler’s formula shown below.
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 Q1.java.
Your main method should measure the elapsed time and compute the difference between Math.PI and
the approximated PI value. Format the output as shown below.
Question 2. (30 marks)
A video content provider maintains a daily log of the clients’ streaming requests. The streaming requests
are stored in a file (video_data.txt) with one request per line. Each streaming request contains the
following three fields separated by commas:
• a timestamp (represented by a long integer),
• a video ID (a string), and
• a client’s IP address
Write a Java program to find out the top 5 most active clients in the log, i.e. the 5 IP addresses with the
highest view count.
Implement the methods findTop5Clients(List list) in the class Q2.java. You are required to
use Stream API to create one single processing pipeline only. Any imperative approaches are considered
invalid and will receive no marks. The specification of the methods is written in the comment section.
The expected program output is as follow:
END OF PAPER

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!