Trying to take my sumDanceScore method and divide each element in my danceScore array by the return value of sumDanceScore; however, when It just keeps comming back 0. I have placed println's to show that there are two legitamate integers there however it is always ==0 please help!
package javasandbox;
import java.util.*;
public class JavaSandbox {
public static int sumDanceScore(int danceScore[], int first, int last)
{
if (first > last)
{
return 0;
}
else
{
int total = sumDanceScore(danceScore,first+1,last) + danceScore[first];
return total;
}
}
public static void main(String[] args)
{
Scanner kbd = new Scanner(System.in);
System.out.println("Enter number of contestants : ");
int numContest = kbd.nextInt();
int danceScore[] = new int[numContest + 1];
int first = 0;
int last = danceScore.length - 1;
System.out.println("Enter dance scores: ");
int numContestIndex;
for (numContestIndex = 1; numContestIndex <= numContest; numContestIndex++)
{
danceScore[numContestIndex] = kbd.nextInt();
}
int danceScoreTotal = sumDanceScore(danceScore, first, last);
System.out.println("SUM DANCE SORE METHOD: "+danceScoreTotal);
for(int danceScoreIndex = 1; danceScoreIndex <= danceScore.length-1; danceScoreIndex++)
{
System.out.println("DANCE SCORE INDEX NUMBER: "+danceScore[danceScoreIndex]);
int danceScoreShare = danceScore[danceScoreIndex] / danceScoreTotal;
System.out.println("DANCER SHARE PERCENT: "+danceScoreShare);
}
}
}