CIS 260 Computer Programming I

Program Requirements: Election Results

 

In a previous in-class exercise we looked at the problem of entering the votes and determining the results of an election. This project will be based on the same problem, but will use an Object Oriented Design approach.

Write a program that allows the user to enter the last names of five candidates in a local election and the votes received by each candidate. The program should then output each candidate's name, the votes received by that candidate, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election.

Candidate    Votes Received    % of Total Votes
---------    --------------    ----------------
Johnson        5000                25.91%
Miller         4000                20.72%
Duffy          6000                31.09%
Mason          2500                12.95%
Hudson         1800                 9.33%

Total of Votes: 19300

The Winner of the Election is Duffy.
 

Create a class Candidate with data fields for name and votes and a method for percentage. Candidate should not do ANY screen or keyboard I/O, but you will be able to test it using BlueJ and other classes.

Create a class Election with methods for each of the operations, and appropriate constructors.

The user interface (including all I/O) will be contained in methods of Election. main()should be in a third class ElectionTest, calling the appropriate methods from Election in the correct order..

Project Deliverables:

-+Final Program: (All components in Presentation Format )
Problem Description
UML Class Diagrams for Election and Candidate
Algorithm for main
Test Set Design
Source Code
Sample Output