Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

Can you write this code using c++? Thank you!

16
17
#include <iostream>
18
#include <iomanip>
19
20
using namespace std;
21
22
const int QUARTERS
4;
23
24
// Write the prototype of printSalseData here.
25
26
27 int main() {
double salesData [3] [QUARTERS] {0};
for (int div
for (int qtr
28
29 E
30 E
0; div < 3; ++div) {
0; qtr < QUARTERS; ++qtr) {
31
cin >> salesData[div][qtr];
}
// Complete the call statement below.
printSalesData();
34
35
36
return 0;
37
}
38
39
// Write the definition of printSalseData here.
40
41
42
43
O H N
M M M M
expand button
Transcribed Image Text:16 17 #include <iostream> 18 #include <iomanip> 19 20 using namespace std; 21 22 const int QUARTERS 4; 23 24 // Write the prototype of printSalseData here. 25 26 27 int main() { double salesData [3] [QUARTERS] {0}; for (int div for (int qtr 28 29 E 30 E 0; div < 3; ++div) { 0; qtr < QUARTERS; ++qtr) { 31 cin >> salesData[div][qtr]; } // Complete the call statement below. printSalesData(); 34 35 36 return 0; 37 } 38 39 // Write the definition of printSalseData here. 40 41 42 43 O H N M M M M
The company has three divisions. The program uses a 2-D array of three rows and four columns. Each column
represents one quarter of the year. Each row represents the sales data of one division.
The program consists of a main function and another function for displaying a 2-D array passed in through arguments.
The program has defined a global constant to represent the number 4 as the four quarters of an year. Use this constant
identifier wherever the number 4 is required as the four quarters of a year.
Write the prototype for the function named printSalesData above the main function. The function receives a 2-D array
as the first argument and the number of divisions as the second argument. It returns void.
The main function has a 2-D array defined and initialized. It then reads the data from user to fill the array. You need to
supply the data when the program runs.
Complete the call statement that calls printSalesData function with the appropriate arguments to print the report.
Below the main function, write the definition of printSalseData.
Test The Program with the following input.
201.24
150.91
270.83
421.51
312.43
422.14
251.85
732.53
271.83
321.55
321.67
641.69
Here is the expected output.
Corporation Sales Report
DIV
Q1
Q2
Q3
Q4
201.24
150.91
270.83
421.51
1
312.43
422.14
251.85
732.53
271.83
321.55
321.67
641.69
expand button
Transcribed Image Text:The company has three divisions. The program uses a 2-D array of three rows and four columns. Each column represents one quarter of the year. Each row represents the sales data of one division. The program consists of a main function and another function for displaying a 2-D array passed in through arguments. The program has defined a global constant to represent the number 4 as the four quarters of an year. Use this constant identifier wherever the number 4 is required as the four quarters of a year. Write the prototype for the function named printSalesData above the main function. The function receives a 2-D array as the first argument and the number of divisions as the second argument. It returns void. The main function has a 2-D array defined and initialized. It then reads the data from user to fill the array. You need to supply the data when the program runs. Complete the call statement that calls printSalesData function with the appropriate arguments to print the report. Below the main function, write the definition of printSalseData. Test The Program with the following input. 201.24 150.91 270.83 421.51 312.43 422.14 251.85 732.53 271.83 321.55 321.67 641.69 Here is the expected output. Corporation Sales Report DIV Q1 Q2 Q3 Q4 201.24 150.91 270.83 421.51 1 312.43 422.14 251.85 732.53 271.83 321.55 321.67 641.69
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education