CS 1401, Quiz 12 based on Test 3, MW version

Date: Monday, December 1, 2014
Name (please type legibly, ideally in block letters): ______________________________________________________________________

3a. Which operating system is the most widely used? To answer this question, write a method that, given an array u of number of users using an operating systems and an array n of their names, returns the name of the most widely used operating system.

3b. To check the correctness of your method, test it on the example of two arrays: array opSystems with elements "Windows 7", "Windows 8", and "Linux", and array users with values 630 million, 40 million, and 100 million.

3c. Trace step-by-step how the piece of code you wrote in Part 3b finds the name of the most widely used operating system.







































4a. Advertisers pay a certain amount for each user. Write a method that, given an array of numbers of users of different operating systems and a payment-per-user value, returns a new array with the amounts given to the owner of each operating system.

4b. To check the correctness of your method, test it in the main program on the example of an array u consisting of 630 million and 40 million users, and a payment of 0.1 cent per user.

4c. Trace step-by-step what happens when you run the piece of code you wrote in Part 4b. The result should be an array consisting of values $630,000 and $40,000.