Write a program that displays the frequencies of sales commissions. The commission for each salesperson is calculated as $200 plus 9% of gross sales. For example a salesperson who grosses $5000 in a week makes 200 + .09 *5000 = 200 + 450 = $650 The program will input a series of weekly gross sales for each salesperson. The program will output the number of salespeople in each of the following ranges:
$200 – 299
$300 – 399
$400 – 499
$500 – 599
$600 – 699
$700 – 799
$800 – 899
$900 – 999
$1000 and over
So far i have written some codes but I am still so stuck. I found a psedocode somewhere online but I do not understand how to write some of the codes.
I know this is a simple code for others but Im still new at this.
import java.util.Scanner;
public class Sales
{
long freqCount[] = new long[9]; // array for storing frequencies
int grossSales = getSalary();
Scanner stdin = new Scanner(System.in)
int salesPeople = 0;
System.out.print("How many salespeople are there? ");
salesPeople = stdin.nextInt();
-- //Call getGrossSales how do I call the getGrossSales method?
long grossSales[] = new long[salesPeople];
long salesComm[] = new long[salesPeople];
// all functions do loading and manipulation
getSalesInput(grossSales);
salesCommissionCalc(grossSales, salesComm);
frequencyCount(salesComm, freqCount);
frequencyDisplay(freqCount);
}
}
public class
{
public static void main(String[] args){
//Declare and initialize variables
//Prompt for number of salespeople (needed to dimension sales arrays).
//Call getGrossSales
//Declare arrays for gross sales and sales commission
//If number of salespeople greater than zero, begin instruction.
//Call method to get gross sales per salesperson, use to populate array.
//Takes gross sales array by reference.
//Call method to calculate sales commissions. Takes gross sales array as parameter
//Needs variables for: frequency(array), initialize all values at 0.
//Call frequency array storage method, which should iterate through array to display results
}
} //end main method