...In the long distant future, in the year 2016, the cable news empire has fallen, and former talking heads have stooped to running for political office. In fact, five former talk show stars are running for President of the United States, and locked in a close race. Your task is to design and implement a set of classes that process a collection of Integer objects, corresponding to votes for each candidate. The integers are stored in a queue by a driver. In particular, the following code must compile error free and execute correctly on your implementation. You should implement your own generic Queue class. If you borrow code from elsewhere, cite your sources. public static void main(String[] args) { Queue<Integer> collection = new Queue<Integer>(); for (int index = 0; index < 10000; index++) { int candidate = ((int) (Math.random() * 10000)) % 5; Integer integ = new Integer(candidate); collection.enqueue(integ); } RequestProcessor processor = new RequestProcessor(collection); int numberOfThreads = 5; Thread[] threads = new Thread[numberOfThreads]; for (int index = 0; index < threads.length; index++) { threads[index] = new Thread(processor); threads[index].start(); } try { for (int index = 0; index < threads.length; index++) { threads[index].join(); } } catch(InterruptedException ie) { ie.printStackTrace(); } ThreadStatisticsSetup.print(); } One possible output is: Tabulator: 1 Count 1137 for candidate Bill O'Reilly=20.695303967965053% ...
Words: 800 - Pages: 4
...Programming Assignment 1 In the long distant future, in the year 2016, the cable news empire has fallen, and former talking heads have stooped to running for political office. In fact, five former talk show stars are running for President of the United States, and locked in a close race. Your task is to design and implement a set of classes that process a collection of Integer objects, corresponding to votes for each candidate. The integers are stored in a queue by a driver. In particular, the following code must compile error free and execute correctly on your implementation. You should implement your own generic Queue class. If you borrow code from elsewhere, cite your sources. public static void main(String[] args) { Queue collection = new Queue(); for (int index = 0; index < 10000; index++) { int candidate = ((int) (Math.random() * 10000)) % 5; Integer integ = new Integer(candidate); collection.enqueue(integ); } RequestProcessor processor = new RequestProcessor(collection); int numberOfThreads = 5; Thread[] threads = new Thread[numberOfThreads]; for (int index = 0; index < threads.length; index++) { threads[index] = new Thread(processor); threads[index].start(); } try { for (int index = 0; index < threads.length; index++) { threads[index].join(); } } catch(InterruptedException...
Words: 879 - Pages: 4
...Research Methods of Proposed Study…………………………….. Ethical Considerations of Proposed Study………………………………………….. References………………………………………………………………………….4 Chapter I: Introduction Statement of the Problem For anyone that is familiar with Canadian politics, especially in the Canadian Senate, corruption is a common theme. Richard Gwyn proposed that Canada’s political integrity was near perfect up until 1975, where political transgressions became prominent in the news. What Gwyn fails to note is the many smaller transgressions that have surfaced prior to 1975, which may not fall into the category of noteworthy (Gibbons & Rowat, 1975). The empirical evidence that must be stated with response to Canada’s political corruption is what is considered by many to be political integrity. What questions must also be answered; are what is considered shabby politics? Is Canada’s political integrity really as spotless as it seems, or are some transgressions overlooked because of what some people actually consider corruption? Purpose of the Proposed Research Study The proposed study will examine what citizens really consider to be political corruption. A sample population will be given a questionnaire to quantitatively test the opinions of Canadians to...
Words: 1872 - Pages: 8
...resolve comes from the answers to these questions. g. Which course of action develops moral virtues? h. Does this impetus the command good without showing prejudice? i. Does my action affect and respects the moral rights of the party? References Whitbeck, C. (1996). Ethics as design: Doing justice to moral problems. Hastings Center Report, 26(3). Pages 9-16. Ferrell, O. C., & Gresham, L. G. (1985). A contingency framework for understanding ethical decision making in marketing. The Journal of Marketing, 87-96. Wand, J. N., Shotts, K. W., Sekhon, J. S., Mebane Jr, W. R., Herron, M. C., & Brady, H. E. (2001). The butterfly did it: The aberrant vote for Buchanan in Palm Beach County, Florida. American Political...
Words: 284 - Pages: 2