Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program i 2: A wholesale company has five branch offices The quarterly sales figure for these branch offices are summarized in a table (to be

image text in transcribed
image text in transcribed
Program i 2: A wholesale company has five branch offices The quarterly sales figure for these branch offices are summarized in a table (to be represented by a 2-D array) is shown below: Branch-1 Branch-2 Branch-3 Branch-4 Branch-5 Total Quarter-1 150,000 273,550 124,300 57,800 79,430 Quarter-2 123,350 100,500 277,000 39,540 98,430 Quarter-3 67,000 232,000 122,500 17,000 320,000 Quarter-4 95,000 76,000 87,000 250,000 240,000 Total: Fig 2 Sales report by branch offices and by quarter. Using a 2-D array (to store sales figures by branch and by quarter as shown) and two 1-D arrays (to store column and row sums), write a program to compute and display values in blue cells (column sums) and brown cells (row sums). Convince yourself that each column sum represents total amount of sales generated by a particular branch office and each row sum represents the total amount of sales generated by all branch offices for a particular quarter. Also compute the value for the green cell, which represents the total amount of sales generated by all branches offices for the entire year. Your program should be composed of the main function, a function named fill2Darray and a third function named computeSales. The main function declares three arrays described above, calls the fill2DArray function to fill cells with values shown in Fig 2. The main function then calls the computeSalses function to compute and then display values for the blues, brown, and green cells with appropriate descriptions of the displayed values. For your convenience, the function prototypes for fill and computeSales functions are provided below" void fill2DArray(int 0[5], int numRows); void computeSales(int [][5], int qtrlySum[], int numQtrs, int branchSum0, int numBranches); Note that arrays are always passed to a function by reference, i the address of the array (or the address of the first element of the array) is passed. Your program output should be similar to the above table

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

More Books

Students also viewed these Databases questions

Question

1 Why might people resist change?

Answered: 1 week ago

Question

LO6 List the components of job descriptions.

Answered: 1 week ago

Question

LO3 Define job design and identify common approaches to job design.

Answered: 1 week ago