Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

----using Java language Write an application(using an array of counters) that de

ID: 3632768 • Letter: #

Question

----using Java language

Write an application(using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges(assume that each salesperson's salary is truncated to an integer amount):

       a) $200-299

       b) $300-399

       c)$400-599

       d)$500-599

       e)600-699

      f) 700-799

       g)800-899

      h)900-999

      i)1000 and over

The salespeople receive $200 per week plus 9% of their gross sales for that week. Summarize the results in tabular format.

I NEED SOME HELP RIGHT AWAY   OR   MY GRADE FOR THE COURSE WILL BE GREATLY AFFECTED------PLEASE!!!!

Explanation / Answer

please rate - thanks

import java.util.*;
public class main
{public static void main(String[] args)
{int index;
double salary;
int grossSales=1;
int[] salaryRange=new int[10];
Scanner in=new Scanner(System.in);
for(index = 0; index <10; index++)
     salaryRange[index] = 0;
System.out.print("Enter the saleman's gross sales (<=0 to END): ");
grossSales=in.nextInt();
while(grossSales>0)
{salary=getSalary(grossSales);
setRange(salaryRange,salary);
System.out.print("Enter the saleman's gross sales (<=0 to END): ");
grossSales=in.nextInt();
}

for(index=0; index<8; index++)
      System.out.println("$"+(index*100+200)+"-$"+((index+1)*100+200-1 )+": "+salaryRange[index]);
System.out.println("$1000 and over "+salaryRange[8]);
}
public static int getSalary(int grossSales)
{int salary;
salary=(int)(200+(grossSales*(9./100.)));
return salary;
}
public static void setRange(int salaryRange[],double salary)
{int index=(int)((salary/100)-2);
if(salary>1000)
    salaryRange[8]+=1;
else
    salaryRange[index]+=1;
}


}