Saleperson Java Assignment

Use a set of arrays to solve the following problem. You do not need to implement more than one class for this problem:

 

A company has three salespeople (1 to 3) who sell five different products (1 to 5). Once a day, each salesperson passes in a slip for each type of product sold. Each slip contains the following:

a) The salesperson number

b) The product number

c) The total dollar value of that product sold that day

 

Thus, each salesperson passes in between 0 and 5 sales slips per day. Assume that the information from all the slips for the month is available (there are multiple sales slips for each salesperson). Write an application that will read all the information for last month’s sales and summarize the total sales by salesperson and by product. All totals for each salesperson should be stored in an array. Therefore, you will need at least three arrays.

 

After processing all the information for the month, display the results in tabular format (as seen below), with each column representing a salesperson and each row representing a product. Cross-total each row to get the total sales of each product for the month. Cross-total each column to get the total sales by salesperson for the month. Your tabular output should include these cross-totals to the right of the totaled rows and below the totaled columns (See sample executions).

 

You are required to use a do-while repetition for the input and a for repetition for the output of results.

 

Assuming the table below is an array of sales data for a single salesperson, then each cell contains the total sold for each product (1 through 5) for the entire month by that salesperson.

 

321.89

0.00

102.45

23.76

0.00

 

SAMPLE EXECUTION 1:

 

Enter Salesperson number (1-3) or other number to quit: 9

Product Salesperson 1 Salesperson 2 Salesperson 3 Total

 

1 $0.00 $0.00 $0.00 $0.00

2 $0.00 $0.00 $0.00 $0.00

3 $0.00 $0.00 $0.00 $0.00

4 $0.00 $0.00 $0.00 $0.00

5 $0.00 $0.00 $0.00 $0.00

Total $0.00 $0.00 $0.00 $0.00

 

Press any key to close...

 

SAMPLE EXECUTION 2:

 

Enter Salesperson number (1-3) or other number to quit: 3

Enter product number (1-5): 2

Enter amount sold: 321.54

Enter Salesperson number (1-3) or other number to quit: 1

Enter product number (1-5): 1

Enter amount sold: 56.90

Enter Salesperson number (1-3) or other number to quit: 2

Enter product number (1-5): 1

Enter amount sold: 98.67

Enter Salesperson number (1-3) or other number to quit: 3

Enter product number (1-5): 3

Enter amount sold: 105.23

Enter Salesperson number (1-3) or other number to quit: 1

Enter product number (1-5): 5

Enter amount sold: 46.89

Enter Salesperson number (1-3) or other number to quit: 2

Enter product number (1-5): 1

Enter amount sold: 10.50

 

Enter Salesperson number (1-3) or other number to quit: 8

Product Salesperson 1 Salesperson 2 Salesperson 3 Total

 

1 $56.90 $109.17 $0.00 $166.07

2 $0.00 $0.00 $321.54 $321.54

3 $0.00 $0.00 $105.23 $105.23

4 $0.00 $0.00 $0.00 $0.00

5 $46.89 $0.00 $0.00 $46.89

Total $103.79 $109.17 $426.77 $639.73

 

Press any key to close...

Need a custom answer at your budget?

This assignment has been answered 6 times in private sessions.

© 2024 Codify Tutor. All rights reserved