Explore BrainMass

Explore BrainMass

    Multidimensional Arrays and Vectors

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    I need the following in C++

    Suppose that a certain automobile dealership sells ten different models of automobiles and employees eight salespersons. A record of sales for each month can be represented by a table in which each row contains the number of sales of each model by a given salesperson and each column contains the number of sales by each salesperson of a given model. For example, suppose that the sales table for a certain month is as follows:

    0 0 2 0 5 6 3 0
    5 1 9 0 0 2 3 2
    0 0 0 1 0 0 0 0
    1 1 1 0 2 2 2 1
    5 3 2 0 0 2 5 5
    2 2 1 0 1 1 0 0
    3 2 5 0 1 2 0 4
    3 0 7 1 3 5 2 4
    0 2 6 1 0 5 2 1
    4 0 2 0 3 2 1 0

    Write a program to produce a monthly sales report, displaying the monthly sales table in the form:

    Salesperson
    Model : 1 2 3 4 5 6 7 8: Totals
    -------------------------------------------------------------------
    1 : 0 0 2 0 5 6 3 0 : 16
    2 : 5 1 9 0 0 2 3 2 : 22
    3 : 0 0 0 1 0 0 0 0 : 1
    4 : 1 1 1 0 2 2 2 1 : 10
    5 : 5 3 2 0 0 2 5 5 : 22
    6 : 2 2 1 0 1 1 0 0 : 7
    7 : 3 2 5 0 1 2 0 4 : 17
    8 : 3 0 7 1 3 5 2 4 : 25
    9 : 0 2 6 1 0 5 2 1 : 17
    10 : 4 0 2 0 3 2 1 0 : 12
    -------------------------------------------------------------------
    Totals : 23 11 35 3 15 27 18 17

    As indicated, the report should also display the total number of automobiles sold by each salesperson and the total number of each model sold by all salespersons.

    © BrainMass Inc. brainmass.com December 24, 2021, 6:52 pm ad1c9bdddf
    https://brainmass.com/computer-science/cpp/multidimensional-arrays-and-vectors-145691

    Solution Summary

    Using multidimensional arrays and aectors in C++ is demonstrated.

    $2.49

    ADVERTISEMENT