The PCCC corporation has four regions, each responsible for sales to a different
ID: 3695675 • Letter: T
Question
The PCCC corporation has four regions, each responsible for sales to a different geographic location. Design a DivSales class that keeps sales data for a division, with the following members:
A data member that holds the region name, possible values are (“East”, “West”, ”North”, “South”).
An array with four elements for holding four quarters of sales figures for the region.
A private static variable for holding the total corporate sales for all divisions for the entire year.
A constructor that initializes the name to null “”, and the quarters to 0;
A null destructor.
A member function that prompts the user to enter the region name and sales for four quarters for that region. The value entered should be added to the static variable that holds the yearly corporate sales.
A member function that returns the region name.
A function that takes an integer argument with the range 0 to 3. The argument is to be used as a subscript into the regions quarterly sales array. The function should return the value of the array element with that subscript.
A member function that returns the total sales for any given region.
A member function that returns the total sale for all regions.
Write a program that creates an array of four DivSales objects. The program should ask the user to enter the region’s name, and sales for four quarters for each region. After the data is entered, the program should display a table showing each region’s name followed by the sales for each quarter, and then followed by the total sale for the region. At the end, the program should display the total corporate sales for the year.
Sample input:
Enter Region : East
Quarter 1 : 32000
Quarter 2 : 34000
Quarter 3 : 45000
Quarter 4 : 55000
Enter Region : West
Quarter 1 : 1000
Quarter 2 : 2000
Quarter 3 : 3000
Quarter 4 : 4000
Enter Region : North
Quarter 1 : 2000
Quarter 2 : 4000
Quarter 3 : 6000
Quarter 4 : 8000
Enter Region : South
Quarter 1 : 3000
Quarter 2 : 6000
Quarter 3 : 9000
Quarter 4 : 12000
Sample output:
East
Quarter 1 32000.00
Quarter 2 34000.00
Quarter 3 45000.00
Quarter 4 55000.00
Region’s total : 166000.00
West
Quarter 1 1000.00
Quarter 2 2000.00
Quarter 3 3000.00
Quarter 4 4000.00
Regions total : 10000.00
North
Quarter 1 2000.00
Quarter 2 4000.00
Quarter 3 6000.00
Quarter 4 8000.00
Regions total : 20000.00
South
Quarter 1 3000.00
Quarter 2 6000.00
Quarter 3 9000.00
Quarter 4 12000.00
Regions total : 30000.00
All Regions Total : 226000.00
Extra work:
All Regions Quarter 1 39000.00
All Regions Quarter 2 46000.00
All Regions Quarter 3 63000.00
All Regions Quarter 4 79000.00
Requirements:
Comment thoroughly, each function should have its specification above it (2 or 3 lines).
The client program includes the function main where the array of objects is declared/instantiated.
All accessor member functions are constant.
The class DivSales is defined in a header file.
All methods are defined in an implementation file
Include the preprocessor #ifndef..endif as a guard.
Include a class diagram for the class DivSales.
Explanation / Answer
#include #include #include using namespace std; class DivSales { private: double quarter [4]; static double DivCorp; public: double display(int); void qutrSale(); }; double DivSales::DivCorp = 0; void DivSales::qutrSale() { int number; for (number = 0; number < 4; number++) { coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.