A corporation has six divisions, each responsible for sales of different geographic locations. The DivSales class holds the quarterly sales data for one division. Complete the  DivSales class which keeps sales data for  one division, with the following members: sales - a private array with four elements of type double for holding four quarters of sales figures for one division. (Note this is not a dynamic array). This is provided. totalSales - a private static variable of type double for holding the total corporate sales for all the divisions (every instance of DivSales) for the entire year. a default constructor that sets all the quarters to 0 . This is provided. setSales - a member function that takes four arguments of type double, each assumed to be the sales for one quarter. The value of each argument should be copied into the private sales array. The total of the four arguments should be added to the static variable totalSales that holds the total yearly corporate sales. If a sales value is < 0, set the value to 0. getQSales - a constant member function that takes an integer argument in the range of 0 to 3. The argument is to be used as a subscript into the quarterly sales array. The function should return the value of the array element that corresponds to that subscript or return 0 if the subscript is invalid. getCorpSales - a static member function that returns the total corporate sales Download the file DivSales_startfile.cpp and use this as your start file. The start file creates a  divisions array of six  DivSales objects that are each initialized with the default constructor. The default constructor is already implemented for you. Below is the quarterly sales data for the six divisions. Your program should populate the  divisions array with the following data set  using the setSales method of your class. 3000.00, 4000.00, 5000.00, 6000.00 3500.00, 4500.00, 5500.00, 6500.00 1111.00, 2222.20, 3333.30, 4444.00 3050.00, 4050.00, 5050.00, 6050.00 3550.00, 4550.00, 5550.00, 6550.00 5000.00, 6000.00, 7000.00, 8000.00 DO NOT PROMPT FOR USER INPUT IN THIS PROGRAM. Use your  setSales method with the data set above to set the values of each object in the divisions array. After the six objects are updated, the program should display the quarterly sales for each division with labels. The program should then 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...
icon
Related questions
Question
100%
A corporation has six divisions, each responsible for sales of different geographic locations.
The DivSales class holds the quarterly sales data for one division. Complete the  DivSales class which keeps sales data for  one division, with the following members:
  • sales - a private array with four elements of type double for holding four quarters of sales figures for one division. (Note this is not a dynamic array). This is provided.
  • totalSales - a private static variable of type double for holding the total corporate sales for all the divisions (every instance of DivSales) for the entire year.
  • a default constructor that sets all the quarters to 0 . This is provided.
  • setSales - a member function that takes four arguments of type double, each assumed to be the sales for one quarter. The value of each argument should be copied into the private sales array. The total of the four arguments should be added to the static variable totalSales that holds the total yearly corporate sales. If a sales value is < 0, set the value to 0.
  • getQSales - a constant member function that takes an integer argument in the range of 0 to 3. The argument is to be used as a subscript into the quarterly sales array. The function should return the value of the array element that corresponds to that subscript or return 0 if the subscript is invalid.
  • getCorpSales - a static member function that returns the total corporate sales
Download the file DivSales_startfile.cpp and use this as your start file. The start file creates a  divisions array of six  DivSales objects that are each initialized with the default constructor. The default constructor is already implemented for you.
Below is the quarterly sales data for the six divisions. Your program should populate the  divisions array with the following data set  using the setSales method of your class.
  1. 3000.00, 4000.00, 5000.00, 6000.00
  2. 3500.00, 4500.00, 5500.00, 6500.00
  3. 1111.00, 2222.20, 3333.30, 4444.00
  4. 3050.00, 4050.00, 5050.00, 6050.00
  5. 3550.00, 4550.00, 5550.00, 6550.00
  6. 5000.00, 6000.00, 7000.00, 8000.00
DO NOT PROMPT FOR USER INPUT IN THIS PROGRAM. Use your  setSales method with the data set above to set the values of each object in the divisions array.
After the six objects are updated, the program should display the quarterly sales for each division with labels. The program should then display the total corporate sales for the year.
13
using namespace std;
14
// class declaration
class DivSales
15
16
17 E {
private:
double sales[4];
18
// sales for 4 quarters of one division
19
20
public:
Divsales();
21
22
23
24
}3
25
26
// function prototypes
27
// main
int main()
28
29
30 E {
31
const int NUM_DIV = 6;
DivSales divisions[NUM_DIV];
// number of divisions
// an array of Divsales objects
// initialized with the default constructor
32
33
34
35
// set values for all objects in divisions array
36
37
38
// Output sales by division
39
40
// Output total sales
41
42
// Output sales by division with operator<<
43
44
// Output total sales
45
46
return 0;
47
Transcribed Image Text:13 using namespace std; 14 // class declaration class DivSales 15 16 17 E { private: double sales[4]; 18 // sales for 4 quarters of one division 19 20 public: Divsales(); 21 22 23 24 }3 25 26 // function prototypes 27 // main int main() 28 29 30 E { 31 const int NUM_DIV = 6; DivSales divisions[NUM_DIV]; // number of divisions // an array of Divsales objects // initialized with the default constructor 32 33 34 35 // set values for all objects in divisions array 36 37 38 // Output sales by division 39 40 // Output total sales 41 42 // Output sales by division with operator<< 43 44 // Output total sales 45 46 return 0; 47
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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 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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY