I need my overall data to all be output as double, but my counter is an int, and i imagine you cant use a double as a counter, so when it goes to compute my data, theres a mismatch between my counter and the rest . i need a way of converting my data to double for out put. Here's my code....i have a test also, all it does is call the main method.
public class Salary
{
public void calcSalary()
{
int wages[]={50000,40000,30000,20000,10000,60000,35000,46000,23000,19000};
final int TOTAL_LENGTH=10; //declare constant
int total[]=new int[TOTAL_LENGTH];
int bonus;
int counter;
System.out.printf("\n%s\t%11s\n\n","REP","SALARY");
for (counter=0; counter <total.length; counter++)
System.out.printf("%2d\t%10d\n",counter, wages[counter]);
counter=0;
System.out.printf("\n\n\n%s\t%10s\n\n","BONUS","TOTAL"); //column headings
while (counter<total.length)
{
if (wages[counter]<=19000)
{
bonus=wages[counter]/100*30;
total[counter]=wages[counter]+bonus;
System.out.printf("%d\t%10d\n",bonus,total[counter]);
}
if (wages[counter]>19000 && wages[counter]<=40000)
{
bonus=wages[counter]/100*20;
total[counter]=wages[counter]+bonus;
System.out.printf("%d\t%10d\n",bonus,total[counter]);
}
if (wages[counter]>40000)
{
bonus=wages[counter]/100*10;
total[counter]=wages[counter]+bonus;
System.out.printf("%d\t%10d\n",bonus,total[counter]);
}
counter=counter+1;
}
}
}