(Total Sales) Use a two-dimensional array to solve the following problem. A company has four salespeople (1 to 4) who sell five different products (1 to 5). Once a day, each salesperson passes in a slip for each different type of product sold. Each slip contains:
- The salesperson number
- The product number
- 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 of the slips for last month is available. Write a program that will read all this information for last month’s sales and summarize the total sales by salesperson by product. All totals should be stored in the two-dimensional array sales. After processing all the information for last month, print the results in tabular format with each column representing a particular 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 tabular printout should include these cross totals to the right of the totaled rows and to the bottom of the totaled columns.
Learn your wayIncludes step-by-step video
Chapter 6 Solutions
C How To Program Plus Mylab Programming With Pearson Etext -- Access Card Package (8th Edition)
Additional Engineering Textbook Solutions
Starting Out With Visual Basic (8th Edition)
Starting Out with C++ from Control Structures to Objects (8th Edition)
Database Concepts (8th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Artificial Intelligence: A Modern Approach
Differential Equations: Computing and Modeling (5th Edition), Edwards, Penney & Calvis
- (Electrical eng.) a. An engineer has constructed a two-dimensional array of real numbers with three rows and five columns. This array currently contains test voltages of an amplifier. Write a C++ program that interactively inputs 15 array values, and then determines the total number of voltages in these ranges: less than 60, greater than or equal to 60 and less than 70, greater than or equal to 70 and less than 80, greater than or equal to 80 and less than 90, and greater than or equal to 90. b. Entering 15 voltages each time the program written for Exercise 7a runs is cumbersome. What method could be used for initializing the array during the testing phase? c. How might the program you wrote for Exercise 7a be modified to include the case of no voltage being present? That is, what voltage could be used to indicate an invalid voltage, and how would your program have to be modified to exclude counting such a voltage?arrow_forward(Numerical) Given a one-dimensional array of integer numbers, write and test a function that displays the array elements in reverse order.arrow_forwardCorrect answer will be upvoted else Multiple Downvoted. Computer science. assume mid=⌊max(array)+min(array)2⌋, where max and min — are capacities that track down the maximum and the base array components. At the end of the day, mid is the amount of the maximum and the base component of array separated by 2 adjusted down. Then, at that point, the array is parted into two parts left and right. The left array contains all components which are not exactly or equal mid, and the right array contains all components which are greater than mid. Components in left and right maintain their relative control from array. During the third step we pick which of the left and right arrays we want to keep. The picked array replaces the current one and the other is permanently discarded. You want to assist Mike with discovering the aftereffects of q beauty tests. Note that you test the attractiveness of the array a, so you start each beauty test with the primordial (initial) array a.…arrow_forward
- Indicate true or false for the following statements: Every element in an array has the same type. The array size is fixed after it is declared. The array size declarator must be a constant expression. The array elements are initialized when an array is declared.arrow_forwardCreate a program for Matrix with the following requirements: 1. Allow the user to select what operation to perform like: finding eigenvalues and eigenvectors, sketching the Gershgorin circles, and diagonalization. 2. Allow the user to input any size of the matrices and their elements. 3. Display the matrix input and the result of the operation.arrow_forwardDimensionary Investigation Code in C languagearrow_forward
- i. Creates a matrix using: B=rand (20) a-write a program to find all numbers less than or equal 0.5 and put them in a new matrix with dimension 20x10. you can extend with zeros to fill the matrix. b- Do same as point a for all numbers above 0.5. c- Count all the numbers less or equal 0.3 , the numbers between 0.3 and 0.7 and count the numbers more than or equal 0.7.Put the results in a new vector with dimension 3x1. d- Replace the numbers of between 0.7 and 0.9 with 1. e- Add all the elements column wise.arrow_forward(Check test scores) The answers to a true-false test are as follows: T T F F T. Given a two-dimensional answer array, in which each row corresponds to the answers provided on one test, write a function that accepts the two-dimensional array and number of tests as parameters and returns a one-dimensional array containing the grades for each test. (Each question is worth 5 points so that the maximum possible grade is 25.) Test your function with the following data: int score = 0;arrow_forwardIn C++arrow_forward
- Alert dont submit AI generated answer.arrow_forward(Compute total marks for each student) Suppose the marks obtained by all students are stored ina two-dimensional array. Each row records a student’s marks for five tests. For example, the followingarray stores the test marks for eight students. Write a program that displays students and the totalmarks they obtained in five tests, in decreasing order of the total marks.arrow_forwardExercise 2. (Pascal's Triangle) Pascal's triangle Pn is a triangular array with n+1 rows, each listing the coefficients of the binomial expansion (x+ y)', where 0 _ "/workspace/project3 рython3 pавса1.ру 10 1 1 1 1 2 1 1 33 1 1 4 6 4 1 1 5 10 10 5 1 16 15 20 15 6 1 1 7 21 35 35 21 7 1 1 8 28 56 70 56 28 8 1 1 9 36 84 126 126 84 36 9 1 1 10 45 120 210 252 210 120 45 10 1 В равса1.ру import stdarray import stdio іпрort вys # Accept n (int) as command -line argument. ... # Setup a 2D ragged list a of integers. The list must have n + 1 rovs, vith the ith (0 <= i # <= n) row a[i] having i + 1 elements , each initialized to 1. For example, if n = 3, a should be # initialized to [[1], [1, 1], [1, 1, 1], [1, 1, 1, 1]]. a =... for i in range (...): ... # Fill the ragged list a using the formula for Pascal's triangle 1] [j - 1) + a[i - 1] [j] a [i][j] = a[i - 1] [j - 1] + a[i - 1] [j] #3 # vhere o <- i <- n and 1 <= j < i. for i in range (...): for j in range (...): ... # Write a to standard…arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr