Create an overloaded output operator operator<< as a stand-alone function for your DivSales class. You may not use friend .The output operator should display the sales for each quarter of a single division (single object of the class) with labels. Remember DivSales represents the quarterly sales of one division of a company. Use it in your main program to output the quarterly sales for each division in the company (for each object in the divisions array). You will need a loop. After all divisions are displayed, display the total corporate sales for the year.
Create an overloaded output operator operator<< as a stand-alone function for your DivSales class. You may not use friend .The output operator should display the sales for each quarter of a single division (single object of the class) with labels. Remember DivSales represents the quarterly sales of one division of a company. Use it in your main program to output the quarterly sales for each division in the company (for each object in the divisions array). You will need a loop. After all divisions are displayed, display the total corporate sales for the year.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Create an overloaded output operator operator<< as a stand-alone function for your DivSales class. You may not use friend .The output operator should display the sales for each quarter of a single division (single object of the class) with labels. Remember DivSales represents the quarterly sales of one division of a company.
Use it in your main program to output the quarterly sales for each division in the company (for each object in the divisions array). You will need a loop. After all divisions are displayed, display the total corporate sales for the year.
![// number of divisions
// an array of Divsales objects
// initialized with the default constructor
const int NUM_DIV = 6;
DivSales divisions[NUM_DIV];
DivSales set;
divisions[0].setSales (3000.00, 4000.00, 5000.00, 6000.00); // set values for all objects in divisions array
divisions[1].setSales(3500.00, 4500.00, 5500.00, 6500.00);
divisions[2].setSales(1111.00, 2222.20, 3333.30, 4444.00);
divisions[3]. setSales(3050.00, 4050.00, 5050.00, 6050.00);
divisions[4].setSales(3550.00, 4550.00, 5550.00, 6550.00);
divisions[5].setSales(5000.00, 6000.00, 7000.00, 8000.00);
// Output sales by division
cout <« "Output sales by division :" <« endl;
int i = 0;
while(i <6 ) {
cout « "Sales for Division " « i + 1 « endl;
for (int quarter = 0; quarter < 4; quarter++){
cout <« "Quarter" <« quarter +1 <« endl;
cout « divisions[i].getQSales(quarter) <« endl;
>>
i++j
}
// Output total sales
cout <« "Total Corporate Sales:" <« endl;
int totalSales;
for (int i =e; i < 6;i++){
totalsales +- divisions[i].getCorpSales();
}
cout « totalsales <« endl;
!/ Output sales by division with operator<<
// Output total sales
return 0;
}](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9e6fa127-a003-469d-9a51-b1d4610918ed%2F77f2d695-b475-4d32-81e7-9e650edc4336%2Fxbf1gw_processed.png&w=3840&q=75)
Transcribed Image Text:// number of divisions
// an array of Divsales objects
// initialized with the default constructor
const int NUM_DIV = 6;
DivSales divisions[NUM_DIV];
DivSales set;
divisions[0].setSales (3000.00, 4000.00, 5000.00, 6000.00); // set values for all objects in divisions array
divisions[1].setSales(3500.00, 4500.00, 5500.00, 6500.00);
divisions[2].setSales(1111.00, 2222.20, 3333.30, 4444.00);
divisions[3]. setSales(3050.00, 4050.00, 5050.00, 6050.00);
divisions[4].setSales(3550.00, 4550.00, 5550.00, 6550.00);
divisions[5].setSales(5000.00, 6000.00, 7000.00, 8000.00);
// Output sales by division
cout <« "Output sales by division :" <« endl;
int i = 0;
while(i <6 ) {
cout « "Sales for Division " « i + 1 « endl;
for (int quarter = 0; quarter < 4; quarter++){
cout <« "Quarter" <« quarter +1 <« endl;
cout « divisions[i].getQSales(quarter) <« endl;
>>
i++j
}
// Output total sales
cout <« "Total Corporate Sales:" <« endl;
int totalSales;
for (int i =e; i < 6;i++){
totalsales +- divisions[i].getCorpSales();
}
cout « totalsales <« endl;
!/ Output sales by division with operator<<
// Output total sales
return 0;
}

Transcribed Image Text:Output sales by division using operator<< :
Sales for Division 1
Quarter 1: $3000.00
Quarter 2: $4000.00
Quarter 3: $5000.00
Quarter 4: $6000.00
Sales for Division 2
Quarter 1: $3500.00
Quarter 2: $4500.00
Quarter 3: $5500.00
Quarter 4: $6500.00
Sales for Division 3
Quarter 1: $1111.00
Quarter 2: $2222.20
Quarter 3: $3333.30
Quarter 4: $4444.00
Sales for Division 4
Quarter 1: $3050.00
Quarter 2: $4050.00
Quarter 3: $5050.00
Quarter 4: $6050.00
Sales for Division 5
Quarter 1: $3550.00
Quarter 2: $4550.00
Quarter 3: $5550.00
Quarter 4: $6550.00
Sales for Division 6
Quarter 1: $5000.00
Quarter 2: $6000.00
Quarter 3: $7000.00
Quarter 4: $8000.00
Total Corporate Sales: $113510.50
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY