0% found this document useful (0 votes)
128 views2 pages

Summer 2016 ISM 3230 - Homework 6

This document provides instructions for a homework assignment to write a Java program that allows a user to input candidate names and vote totals for a student government election. The program must store this data in arrays, calculate the total votes cast and the percentage of votes for each candidate, and output the candidate names, vote totals, and percentages. It must also include a method to calculate the total votes cast by passing the vote count array as a parameter. Extra credit is offered for determining and printing the election winner.

Uploaded by

Arannya Monzur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
128 views2 pages

Summer 2016 ISM 3230 - Homework 6

This document provides instructions for a homework assignment to write a Java program that allows a user to input candidate names and vote totals for a student government election. The program must store this data in arrays, calculate the total votes cast and the percentage of votes for each candidate, and output the candidate names, vote totals, and percentages. It must also include a method to calculate the total votes cast by passing the vote count array as a parameter. Extra credit is offered for determining and printing the election winner.

Uploaded by

Arannya Monzur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Homework 6 ISM 3230 Summer 2016

Due to Blackboard: Sunday, July 10th 11:59pm


Election
FAU Student Government recently had elections for the new President for the 2016-2017 school
year. You must write a program that allows the user to enter the candidates names and number of
votes receives, calculates the total number of votes cast and the percentage of votes received by
each candidate, and displays the candidates names, the number of votes received, and the
percentage of votes received.
Your program should prompt the user (customer) to enter the following information:
Candidates names
Number of votes received by each candidate
The program then outputs the following information:
Candidates names
Number of votes received by each candidate
Percentage of votes received by each candidate
Total number of votes cast
Please refer to the Sample Output file for full details of what the program should look like when it
runs.
Program requirements:
1. Your program MUST read all of the information about the candidates (names and votes
received) BEFORE doing anything else in the program (e.g. calculating the total number of
votes cast)
2. You MUST store the following information in three different arrays: candidates names;
number of votes received by each candidate; percentage of votes received by each candidate.
3. Your program MUST include the following user-defined method, in addition to the main
method: Calculate total number of votes cast in the election.
This method processes the array of votes received and returns the total number of votes
cast (HINT: Pass the array as a parameter to this method)
Possible high-level outline for the logic of your program (you do NOT have to follow these steps
this is just a suggestion):
Loop to read the name of each candidate into an array and the number of votes received into an
array
Call method to calculate the total number of votes cast
Loop to calculate the percentage of votes earned by each candidate
Loop to print the candidates names, number of votes received, and percentage of votes received
Print total votes cast
NOTE: If your program sometimes skips the step where the user can enter the name of the
candidate, use next() (not nextLine()). None of the candidates names will have spaces, so
nextLine() is not needed.

This assignment MUST be created individually. You must turn in your OWN source code and
Java bytecode executable file. You MAY NOT share files!
Instructions
Compile and execute your program to ensure that it works correctly.
Be sure to run your final program using the sample data included in the Sample Output file
to ensure your program works properly.
Make sure your output labels match those in the Sample Output file exactly.
Notes
You MUST store any calculations in variables (i.e. do not calculate the number of votes or
percentage of votes directly in your System.out.println statements)
You do NOT need to worry about formatting the decimal places on values you calculate
You may perform the tasks in any order as long as your output follows the order of the
output in the example scenarios contained in the Sample Output file
You must include the one user-defined method specified above. You may include additional
methods if you want, but you MUST include at least this method in addition to main.
Do NOT use global variables unless you have a REALLY good reason for doing so.
Extra credit (10 points)
Determine the winner of the election, and print the winner to the screen. Please refer to the Sample
Output BONUS file for formatting details. You do not need special syntax to do this you will
have to think logically about how to solve this problem.
To receive full credit:
Submit the following files in a single zip file to Blackboard
o File with your Java source code (.java file)
o File with your Java bytecode executable file (.class file)
o Refer to the instructions for creating the zip file on Blackboard if you do not
create the file with the correct folders and structure, you will lose points
Course Documents NetBeans Information
You must follow the appropriate Coding Standards listed in the Coding Standards document
under Supplemental Materials on Blackboard.
o 40% of your grade on the source code will be based on how well you follow these
standards and how well you comment your source code
Submit your zip file to Blackboard using the Assignment submission feature by 11:59pm
7/10/2016. Instructions for submission are available on Blackboard where you downloaded
this file (Assignments --> Homework 6).

You might also like