联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codehelp

您当前位置:首页 >> Python程序Python程序

日期:2020-08-06 08:45

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

版权所有:留学生程序辅导网 2019 All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。