Results 1 to 2 of 2
  1. #1
    threlot is offline Member
    Join Date
    Oct 2012
    Posts
    11
    Rep Power
    0

    Default 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.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default 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.

    ** This space for rent **

Similar Threads

  1. Call Different Task Based on their Percentage
    By raihan26 in forum Advanced Java
    Replies: 4
    Last Post: 05-16-2012, 06:04 AM
  2. Transfer file get percentage complete
    By LG87 in forum Networking
    Replies: 5
    Last Post: 06-16-2011, 09:04 PM
  3. Load percentage of an image
    By trishtren in forum Java 2D
    Replies: 0
    Last Post: 04-15-2011, 02:02 PM
  4. Replies: 1
    Last Post: 01-07-2011, 05:33 AM
  5. Percentage/decimal points?
    By Exhonour in forum New To Java
    Replies: 6
    Last Post: 01-16-2009, 10:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •