(5) Create or add another source file called Business.cpp . In this file, declare and implement a function weeklySalesSummary which passes the 2D array, the row number of rows and number of columns which is a 4x6 matrix or table. The row data represents the daily sales for each item and column data represents each day’s sales for all items. Refer to the table in Question 7 below for reference. void weeklySalesSummary(double sales[][6], int row, int col) The function calculates the total of each row and updates the last column under Total with the calculated total on the right which is the 6th and final column. The function also calculates the total for daily sales for all items, and sets it at the last row along Total: row-header. This will include the total for the final 6th column.  The coding will require two sets of nested loops. (6) Create and implement another function called printWeeklySalesSummary which passes the same parameter as those of Question 5, and this function prints the table in exactly the same format as presented below in Question 7. Tip: Use tabs or spaces, to arrange your columns and rows. The item #s will come from the incremented loop index.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

(5) Create or add another source file called Business.cpp . In this file, declare and implement a function weeklySalesSummary which passes the 2D array, the row number of rows and number of columns which is a 4x6 matrix or table. The row data represents the daily sales for each item and column data represents each day’s sales for all items. Refer to the table in Question 7 below for reference.

void weeklySalesSummary(double sales[][6], int row, int col)


The function calculates the total of each row and updates the last column under Total with the calculated total on the right which is the 6th and final column.

The function also calculates the total for daily sales for all items, and sets it at the last row along Total: row-header. This will include the total for the final 6th column. 

The coding will require two sets of nested loops.


(6) Create and implement another function called printWeeklySalesSummary which passes the same parameter as those of Question 5, and this function prints the table in exactly the same format as presented below in Question 7. Tip: Use tabs or spaces, to arrange your columns and rows. The item #s will come from the incremented loop index. 

(7) In the main function, (i) declare a 2D array wkSales with sizes 4 and 6, then initialize it
with the three rows of sales figures, while leaving out the last row and last column figures.
Total
(iii)
(iv)
Items
Mon
Item 1. 22.2
Item 2. 11.1
Item 3. 33.3
Total:
Tue
33.3
66.6
44.4
Wed
55.5
22.2
55.5
Press any key to continue
.
Thu
22.2
44.4
66.6
Fri
77.7
88.8
99.9
Call the weeklySalesSummary function to fill the rest of the blank spaces of
Question 7.
Call the print WeeklySalesSummary function to display the table of Question 7 in
exactly the same format with inclusive of the totals of row 4 and column 6.
Transcribed Image Text:(7) In the main function, (i) declare a 2D array wkSales with sizes 4 and 6, then initialize it with the three rows of sales figures, while leaving out the last row and last column figures. Total (iii) (iv) Items Mon Item 1. 22.2 Item 2. 11.1 Item 3. 33.3 Total: Tue 33.3 66.6 44.4 Wed 55.5 22.2 55.5 Press any key to continue . Thu 22.2 44.4 66.6 Fri 77.7 88.8 99.9 Call the weeklySalesSummary function to fill the rest of the blank spaces of Question 7. Call the print WeeklySalesSummary function to display the table of Question 7 in exactly the same format with inclusive of the totals of row 4 and column 6.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education