Commission Assignment discussion

SoccerBoss
Category:
Health & Medical
Price: $20 USD

Question description

Show Me the Money The primary purpose of this assignment is to practice using and writing subroutines. The question requires that you work with sales data pertaining to sales staff and produce a neat report of each person with their annual sales and commission bonuses along with some additional statistics. For example the output might look like: 

 Commission Bonus Report ----------------------- ID Q1 Sales Q2 Sales Q3 Sales Q4 Sales Annual Sales Commission 9154 7200.55 8456.78 9123.45 8885.34 123456.22 6023.49 8143 17200.55 8456.78 19123.45 8885.34 141111.11 4023.44 . . etc. The sales person with the highest commission was 1234 ($5678.99). The sales person with the lowest commission was 5912 ($34.49). The average commission was $2345.12 Rather than read in the sales data we will generate it randomly using the Math.random() function. Math.random() generates a double precision value x such that 0.0 <= x < 1.0. Note that the value is always strictly less than 1 but is greater than or equal to 0. Write a function called Random that accepts two parameters of type double. The Random function will generate random numbers between a range defined by the parameters, The first parameter defines the lower limit and the second parameter defines the upper limit. Thus Random(5.5, 19.6) would generate random numbers x such that 5.5 <= x < 19.6. Note that our Random will also exclude the upper limit as a possible value. Write a second function also called Random that accepts two parameters of type integer. This Random function will generate random integers between a range defined by the parameters, The first parameter defines the lower limit and the second parameter defines the upper limit. Thus Random(5, 19) would generate random integers x such that 5 <= x <= 19. Note that this Random will NOT exclude the upper limit as a possible integer value. These Random functions demonstrate overloading as discussed in the text in Section 4.3.3. As a hint keep in mind that multiplication stretches the range of random values and addition shifts the range. Then write a Java program that will read in a file of commission information, and generate the sales data. The program will print out the id of each sales person followed by their quarterly sales, total sales for the year, and their commission bonus in a nicely formatted report. The report shows the sum of the quarterly calculated commission amounts. The commission file simply contains a few numbers that define how to calculate commissions and a final numberindicating how many sales staff to work with. The commission amount is calculated for each quarter. The commission file contains 4 lines. The first line contains the level of sales used for the first commission rate that follows. Sales up to this amount generate a commission using the first rate. The second line contains the second level and rate. If the sales for the quarter are between the first and second level then the sales generate a commission using the second rate. The third line contains the third rate. If the sales for the quarter exceed the second level then commission is generated at the third rate. Here is a typical commission file: 50000 5.55 <- if quarterly sales <= 50000 use 5.55% as the rate 70000 6.85 <- if quarterly sales > 50000 and <= 70000 use 6.85% 8.15 <- if quarterly sales > 70000 use 8.15% 14 <- the number of sales staff Note that this data will need to be read into global variables. The id number for each sales person will be generated by your Random function that returns integers. Use parameters of 1001, 9999 when calling this function. The quarterly sales figures for each sales person will be generated by your Random function that returns doubles. When generating random sales figures use 10000.0 and 25000.0 as the parameters. In addition to the Random functions include a subroutine to read in the commission file data and a function to calculate the commission for each quarter. You may include other subroutines or functions if you wish. The input file to use with your program is the commission file. Use right click to save the file on your local machine.

All of this is also seen at: http://www.cosc.brocku.ca/Offerings/1P02/assign3.shtml

Tutor Answer

(Top Tutor) Daniel C.
(997)
School: Carnegie Mellon University
PREMIUM TUTOR
Studypool has helped 1,244,100 students
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1824 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors