# Search:

Type: Posts; User: Gra89

1. ## Thread: Percentage Array Help

by Gra89
Replies
25
Views
967

### Re: Percentage Array Help

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
2. ## Thread: Percentage Array Help

by Gra89
Replies
25
Views
967

### Re: Percentage Array Help

im sorry but I don't know how to do what you are saying to do.
3. ## Thread: Percentage Array Help

by Gra89
Replies
25
Views
967

### Re: Percentage Array Help

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...
4. ## Thread: Percentage Array Help

by Gra89
Replies
25
Views
967

### Re: Percentage Array Help

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...
5. ## Thread: Percentage Array Help

by Gra89
Replies
25
Views
967

### Re: Percentage Array Help

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...
6. ## Thread: Percentage Array Help

by Gra89
Replies
25
Views
967

### Re: Percentage Array Help

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[])...
7. ## Thread: Percentage Array Help

by Gra89
Replies
25
Views
967

### Re: Percentage Array Help

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...
8. ## Thread: Percentage Array Help

by Gra89
Replies
25
Views
967

### Re: Percentage Array Help

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...
9. ## Thread: Percentage Array Help

by Gra89
Replies
25
Views
967

### Re: Percentage Array Help

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
{
...
10. ## Thread: Percentage Array Help

by Gra89
Replies
25
Views
967

### Re: Percentage Array Help

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.
11. ## Thread: Percentage Array Help

by Gra89
Replies
25
Views
967

### Re: Percentage Array Help

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] =...
12. ## Thread: Percentage Array Help

by Gra89
Replies
25
Views
967

### Re: Percentage Array Help

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...
13. ## Thread: Percentage Array Help

by Gra89
Replies
25
Views
967

### Percentage Array Help

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...
14. ## Thread: Mind is going to burst with this code!!!

by Gra89
Replies
3
Views
271

### Re: Mind is going to burst with this code!!!

had same problem other day shoulda known silly me!! thank you so much i feel like crying with relief!!! ^:)^
15. ## Thread: Mind is going to burst with this code!!!

by Gra89
Replies
3
Views
271

### Mind is going to burst with this code!!!

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...
Results 1 to 15 of 15