CIS 174 LAB
ASSIGNMENT #13
Assigned date: Thursday 5/8
Due date: Thursday 5/13
20 points
Write a program to analyze the data and report the winner for an election of
selecting the president of the YMCA in Southern California.
Assume the Southern California has four regions.
The output of the election should be in the following tabular form:
---------------Election Results--------------
Names R1 R2 R2
R3 Total
John 0
0 0 25
25
Mike 80 89
90 67 431
Brown 67 67
60 35 252
Tom 2
90 23 23
346
Jim 98
20 5 76
372
Bush 0
0 89 23
1
Winner: Mike, Votes Received: 431
Total votes polled: 1620
There are six candidates running for the president. The data is provided in two files. One file, candData.txt, consists of the names of the candidates. In the second file, voteData.txt, each line consists of voting results in the following form:
candidate name region# number_of_votes_for_this_candidate
Input Files:
candData.txt Click here to down candData.txt
John
Mike
Brown
Tom
Jim
Bush
voteData.txt Click here to down voteData.txt
John 4 25 Mike 2 42 Brown 3 60 Tom 1 78 Jim 2 50 Mike 2 63 Brown 1 23 Tom 3 80 Jim 3 5 Bush 4 82 Mike 3 90 Brown 2 67 Jim 1 98 Bush 4 23 Mike 1 80 Brown 4 35 Tom 1 50 John 2 34 Tom 4 23 Mike 4 67 Tom 1 2 Jim 4 89 Tom 3 23 Jim 2 20 Bush 3 89 Mike 2 89 Brown 1 67 Tom 2 90 Jim 4 76
Program Requirements: Create the following methods:
public static void processVotes(String[] cNames, int[][] vbRegion,int []totalVotes) throws IOException
public static void printResult(String[] cNames, int[][] vbRegion,int []totalVotes)