Results 1 to 2 of 2
Thread: Percentage in Java
- 11-13-2012, 01:48 AM #1
Member
- Join Date
- Oct 2012
- Posts
- 6
- Rep Power
- 0
Percentage in Java
I'm using BlueJ
I need help in how to calculate and display the percentage of votes that each candidate received?
public String result()
{
String electionResults = "Election Results: \n";
for (int i = 0; i < this.names.length; i++)
{
electionResults += ("\n\t" + names[i] + "--" + votes[i]);
}
return electionResults;
}Last edited by threlot; 11-13-2012 at 02:22 AM.
- 11-13-2012, 09:43 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Re: Percentage in Java
Please use [code] tags [/code] when posting code.
What do you see happening with your code and what should you see?
If you get errors or exceptions then please post them in full (including stack trace) highlighting the code on which they occur.Please do not ask for code as refusal often offends.
Similar Threads
-
Call Different Task Based on their Percentage
By raihan26 in forum Advanced JavaReplies: 4Last Post: 05-16-2012, 06:04 AM -
Transfer file get percentage complete
By LG87 in forum NetworkingReplies: 5Last Post: 06-16-2011, 09:04 PM -
Load percentage of an image
By trishtren in forum Java 2DReplies: 0Last Post: 04-15-2011, 02:02 PM -
How to get a System's total CPU usage percentage using a java program
By userj2ee in forum Advanced JavaReplies: 1Last Post: 01-07-2011, 05:33 AM -
Percentage/decimal points?
By Exhonour in forum New To JavaReplies: 6Last Post: 01-16-2009, 10:35 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks