Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Object Oriented Programming ((in java))) Write a program to solve the following problem using a 2-dimensional array. A company has 4 salespeople (1 to 4)

Object Oriented Programming ((in java)))

Write a program to solve the following problem using a 2-dimensional array. A company has 4 salespeople (1 to 4) who sell 5 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, and

c) the total dollar value of that product sold that day.

Assume that the information from all the slips for last month is available.Write a program that will:

read all this information for last months sales and summarize the total sales by salesperson and by product.

All totals should be stored in a 2-dimensional array. After processing all the information for last month,

display the results in a tabular format, with each column representing a salesperson and each row representing a particular product.

Cross total each row to get the total sales of each product for last month. Cross total each column to get the total sales by salesperson for last month. Your output should include these cross-totals to the right of the totaled rows and to the bottom of the totaled columns.

Sample input/output:

Enter sales person number (-1 to end): 1

Enter product number: 4

Enter sales amount: 1082

Enter sales person number (-1 to end): 2

Enter product number: 3

Enter sales amount: 998

Enter sales person number (-1 to end): 3

Enter product number: 1

Enter sales amount: 678

Enter sales person number (-1 to end): 4

Enter product number: 1

Enter sales amount: 1554

Enter sales person number (-1 to end): -1

Product Salesperson 1 Salesperson 2 Salesperson 3 Salesperson 4 Total

1 0.00 0.00 678.00 1554.00 2232.00

2 0.00 0.00 0.00 0.00 0.00

3 0.00 998.00 0.00 0.00 998.00

4 1082.00 0.00 0.00 0.00 1082.00

5 0.00 0.00 0.00 0.00 0.00

Total 1082.00 998.00 678.00 1554.00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

Design a training session to maximize learning. page 296

Answered: 1 week ago

Question

Design a cross-cultural preparation program. page 300

Answered: 1 week ago