I did it <:-P finally!!
Thank u so much for the help I can now submit it and go to bed!!! :)
The result of the election is:
Candidate Votes % of Total Votes
Type: Posts; User: Gra89
I did it <:-P finally!!
Thank u so much for the help I can now submit it and go to bed!!! :)
The result of the election is:
Candidate Votes % of Total Votes
im sorry but I don't know how to do what you are saying to do.
I don't understand how to do that how to save the index into the array where the max value was found?
I'm really no expert I find if I am given an example then I learn from my mistakes you may...
the names are the candidate variable.
but need to output the name of the candidate with the max votes which I have but can only print out the max votes not the candidates name that had the max...
just ran it again and I dont have the winners name just the votes how do I do that?
do I need to set up another array for the winner?
and DecimalFormat class means nothing to me lecturer just...
got it working thanks for the help!
Just one thing how to I format the percentage to 2 decimal places?
import java.util.Scanner;
class Election2
{
public static void main(String args[])...
no i don't understand what you mean if you could just give me an example of what you are talking about then I would know.
If you mean that I cant work with the percentage until the loop has...
I'm looking for help with this I don't know what I am doing wrong I know that having
double percentage = (double) votes[i] / (double) sum * 100;
in the for loop isnt doing what I want it to do...
vote is the candidates vote and sum is the total votes i changed it so its simpler
import java.util.Scanner;
class Election2
{
public static void main(String args[]) throws Exception
{
...
I don't know any formula other than what i said the candidates vote / the total votes and * by 100 I haven't been given a formula.
im really confused if i move it out like so
for(int i = 0; i < candidate.length; i++)
{
System.out.println("Please enter the total votes for " + candidate[i]);
votes[i] =...
I guess what I am stuck on is actually how do I assign the votes for each candidate to the percentage variable at the end not every time a vote is inputed by the user so this is as far as can go...
Im only starting arrays and im stuck on the percentage of the total votes. I have all the rest of it compiling Im just getting an error when I try with the percentage bit. I havent finished the last...
had same problem other day shoulda known silly me!! thank you so much i feel like crying with relief!!! ^:)^
Ive to write a software program that allows a user to order groceries?
Ive to ask for the users details names, address etc.
I have to ask the user to input their grocery item and then the...