ElectionResults

ElectionResults - /* / Author: D.S. Malik / / Program:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//************************************************************** // Author: D.S. Malik // // Program: Election Results // Given candidates' voting this program determines the winner // of the election. The program outputs the votes received by // each candidate and the winner. //************************************************************** / import java.io.*; import java.util.*; i public class ElectionResults { final static int NO_OF_CANDIDATES = 6; final static int NO_OF_REGIONS = 4; public static void main (String[] args) throws FileNotFoundException { //Step 1 String[] candidatesName = new String[NO_OF_CANDIDATES]; int[][] votesByRegion = new int[NO_OF_CANDIDATES][NO_OF_REGIONS]; int[] totalVotes = new int[NO_OF_CANDIDATES]; Scanner inFile = new Scanner(new FileReader("candData.txt")); //Step 2 getCandidatesName(inFile, candidatesName); //Step 3 sortCandidatesName(candidatesName); //Step 4 inFile = null; inFile = new Scanner(new FileReader("voteData.txt")); //Step 5 processVotes(inFile, candidatesName,
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

ElectionResults - /* / Author: D.S. Malik / / Program:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online