Question
You decide the next step is to make a multiplayer, MMO-style version of it. Players will log into a central server, which will maintain a
You decide the next step is to make a multiplayer, MMO-style version of it. Players will log into a central server, which will maintain a queue of login requests so that not too many people are playing at the same time.
Unfortunately, the intern you hire to help you write the MMO code never passed his data structures class. (This makes you wonder why you hired him in the first place, but thats a discussion for another time!) He insists that the login queue should store the queue elements in a linked list and should always fix the front of the queue at the tail of the list, because thats easier.
All your attempts at explaining why this is a Horrible Idea are met with much resistance. And due to strict labor laws, you cant just fire the intern without good reason. So you decide the best course of action is to implement the interns plan, deploy it on your live server, watch your game subscriptions take a precipitous dive, blame the intern for it, use that as a reason to let him go, and then sue him to recover your lost revenue. Because MURICA.
a. (10 pts) Write a NaughtyLLQueue
b. (5 pts) Write a client program that simulates the logging in of 100,000 players by using your bad queue implementation as well as the good implementation that we wrote in class. Measure the time needed to enqueue all 100,000 players, and then the time needed to remove them all from the queue.
Remember that you can use the built-in method System.currentTimeMillis() to get the current system time in milliseconds. Use this as a stopwatch call currentTimeMillis once to get the starting time, execute the code you want to time, and then call currentTimeMillis again to get the ending time. The elapsed time is simply the difference between the start and end times.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started