Question

Using one-dimensional array to calculate sales commissions of salespeople.

----using Javalanguage

Writean application(using an array of counters) that determines how many of the salespeople earnedsalaries in each of the followingranges(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 salespeoplereceive $200 per weekplus 9% of theirgrosssalesfor that week.Summarize the results intabular format.

I NEED SOME HELPRIGHT AWAYORMYGRADEFORTHECOURSE WILLBEGREATLY AFFECTED------PLEASE!!!!

0 0
Add a comment Improve this question Transcribed image text
✔ Recommended Answer
Answer #1

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;
}


}

answered by: Laury
Add a comment
Know the answer?
Add Answer to:
Using one-dimensional array to calculate sales commissions of salespeople.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • C# Use a one-dimensional array to solve the following problem: A company pays its salespeople on...

    C# 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 $5000 in sales in a week receives $200 plus 9% of $5000, 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...

  • Why am I getting the same results with my rand() every time I run my C++...

    Why am I getting the same results with my rand() every time I run my C++ program? I am trying to do this problem: each receive $200 per week plus 9 percent of their gross sales for that week. For example, a salesperson who grosses $5000 in sales in a week receives $200 plus 9 percent of $ 5000, or a total of $650. Write a program(using an array of counters) that determines how many of the salespeople earned salaries...

  • help me with the requirement 7and 8 and also check if everything is correct and also...

    help me with the requirement 7and 8 and also check if everything is correct and also make sure requirement 5 is correct where I entered 1500 in the yellow box please go through to every pic and make sure everything is correct 40 points Accounting 202 - Fall 2019 Project 3 - Operating Budget Enter the last 4 digits of your student ID number: Name/s: Highest Lowest other than 0 Save this file in EXCEL FORMAT as: P3Lastname Round all...

  • REINFORCE YOUR SKILLS: E8-R3 Calculate Company Matching Amount In this exercise, you will look up the...

    REINFORCE YOUR SKILLS: E8-R3 Calculate Company Matching Amount In this exercise, you will look up the amount employees will receive into their retirement savings after Kids for Change decides to implement a tiered system to encourage employees to save more for retirement. 1. Open the E8-R3-Savings file from the Excel Chapter 8 folder and save it as E8-R3-SavingsMatched. 2. Select cell H8, if necessary. 3. Insert a VLOOKUP function. 4. For the Lookup_Value, select cell G8. 5. For the Table_Array,...

  • write a code on .C file Problem Write a C program to implement a banking application...

    write a code on .C file Problem Write a C program to implement a banking application system. The program design must use a main and the below functions only. The program should use the below three text files that contain a set of lines. Sample data of these files are provided with the assessment. Note that you cannot use the library string.h to manipulate string variables. For the file operations and manipulations, you can use only the following functions: fopen(),...

  • Using Merge Sort: (In Java) (Please screenshot or copy your output file in the answer) In...

    Using Merge Sort: (In Java) (Please screenshot or copy your output file in the answer) In this project, we combine the concepts of Recursion and Merge Sorting. Please note that the focus of this project is on Merging and don't forget the following constraint: Programming Steps: 1) Create a class called Art that implements Comparable interface. 2) Read part of the file and use Merge Sort to sort the array of Art and then write them to a file. 3)...

  • Using Doubly Linked List, and Sorting methods: (In Java) (please attach your output with the answer)...

    Using Doubly Linked List, and Sorting methods: (In Java) (please attach your output with the answer) (Please answer if it is correct and working) (Have been getting many wrong and spam answers lately) Introduction: In this project, we use the same file structure of Artist and Art to extend the concepts of array and linked list and have them applied to sorting. The input files of p1arts.txt and p1artists.txt have been slightly modified. They are named p7arts.txt and p7artists.txt. Assignments:...

  • SECTION A (40 marks): Answer ALL Questions in this section. QUESTION ONE a) Aseda Ltd incurred...

    SECTION A (40 marks): Answer ALL Questions in this section. QUESTION ONE a) Aseda Ltd incurred the following cost in its manufacturing operations GH¢ Cost of material purchase 20,000 Import duties 400 Trade discount @10% of purchase cost Cash discount 500 Irrecoverable taxes 1,000 Salary of factory plant operator 2,500 Direct labour 5,000 Salary of factory supervisor 4,000 Cost of expected production losses 800 Administrative overhead (Note) 16,000 Cost of storage of raw material for further processing 2,000 Marketing cost...

  • Assignment Predator / Prey Objectives Reading from and writing to text files Implementing mathematical formulas in...

    Assignment Predator / Prey Objectives Reading from and writing to text files Implementing mathematical formulas in C++ Implementing classes Using vectors Using command line arguments Modifying previously written code Tasks For this project, you will implement a simulation for predicting the future populations for a group of animals that we’ll call prey and their predators. Given the rate at which prey births exceed natural deaths, the rate of predation, the rate at which predator deaths exceeds births without a food...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT