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

This is in Java programming. Use a one-dimensional array to solve the following

ID: 3773725 • Letter: T

Question

This is in Java programming.

Use a one-dimensional array to solve the following problem: A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who grosses $5,000 in sales in a week receives $200 plus 9% of $5,000, or a total of $650. 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):

$200-299

b)    $300-399

c)     $400-499

d)    $500-599

e)     $600-699

f)     $700-799

g)    $800-899

h)     $900-999

i)      $1000 and over

Summarize the results in tabular format.

Explanation / Answer

import java.util.Scanner; // imported scanner class
public class SalesPeople
{
   private double salry; // declared salry of type=double

   public double getsalry( int sales_gross ) // logic to estimate salry, utilizes gross_sales as arguements and gives gross_sales
   {
       double salry = ((sales_gross * 0.09) + 200);
       return salry;
   }

   public void displyMsge( int array_count[]) // logic to appear the result-set
   {
       for (int displyCounter = 0; displyCounter < 9; displyCounter++ )
           //System.out.printf( "%4d%4d%4d", displyCounter + 2 * 100, displyCounter + 2 * 100 + 99, array_count[ displyCounter ] );
       System.out.println(displyCounter + ": " + array_count[displyCounter]);

   }

   public void arrayIncrease( double salry, int array_count [] ) // logic to search out which array_count to increase based on salry
   {

   if (salry >= 1000.00) {
           array_count[8]++;
       } else if (salry >= 900.00) {
           array_count[7]++;
       } else if (salry >= 800.00) {
           array_count[6]++;
       } else if (salry >= 700.00) {
           array_count[5]++;
       } else if (salry >= 600.00) {
           array_count[4]++;
       } else if (salry >= 500.00) {
           array_count[3]++;
       } else if (salry >= 400.00) {
           array_count[2]++;
       } else if (salry >= 300.00) {
           array_count[1]++;
       } else if (salry >= 200.00) {
           array_count[0]++;

       }
   }

   public void way2Sales() // logic to get ip, get salry, array_increase, and displymssge
   {
   int array_count[] = new int [ 9 ]; // intilized an array_count
   int sales_gross; // initilized the variable for ip.
   double salry = 0.0;

   Scanner ip = new Scanner( System.in ); // created scanner to read ip on sales-amount.

   System.out.printf("Please Input sales-amount {'-' to end}"); // users input
   sales_gross = ip.nextInt(); // assigned ip to variable sales_gross

   while ( sales_gross >= 0 ) //whileloop
   {
       salry = getsalry( sales_gross ); // logic call with sales_gross as input, should give the salry
       arrayIncrease( salry, array_count ); //logic call with salry as input

       System.out.printf("Please Input sales-amount {'-' to end}"); //user input
       sales_gross = ip.nextInt(); // assigned ip to variable sales_gross

   }
   displyMsge(array_count);

   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote