Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Corporate Sales Data. This program will have a structure that holds data about e

ID: 667135 • Letter: C

Question

Corporate Sales Data. This program will have a structure that holds data about each division of a corporation. This structure will have a string object that holds the division’s name, 4 doubles that hold the sales totals for each quarter. The structure will also have two other doubles, one for the annual sales and the other will hold the average of the quarter sales. The program should use four variables (instances) of this structure. Each variable should represent one of the following corporate divisions: East, West, North, South. The user should be asked for the four quarters’ sales figures for each division. Each division’s total and average sales should be calculated and stored in the appropriate member of each structure variable. The output of the program will be all the figures in the structures. Validation: Do not accept negative numbers for any sales figures.

Program must have the following functions

void DisplayCorpInformation(const Division& east, const Division& west, const Division& north, const Division& south);

void FindTotalAndAverageSales(Division& div);

void GetDivisionSales(Division& div);

The input should look like this screen shot.

The output should look like this screen shot.

Explanation / Answer

Required Solution:

#include <iostream>
#include <cstring>

using namespace std;
//structure contains information about sales of division
struct Division
{
string name;
double q1,q2,q3,q4;
double annualsales,quartersales;
};

//required methods
void DisplayCorpInformation(const Division& east, const Division& west, const Division& north, const Division& south);
void FindTotalAndAverageSales(Division& div);

//main to test the given scenario
int main()
{
struct Division east,west,north,south;
cout<<"Enter quarterly sales for East division"<<endl;
east.name="East";
cout<< "First quarter:";
cin>>east.q1;
cout<< "Second quarter:";
cin>>east.q2;
cout<< "Third quarter:";
cin>>east.q3;
cout<< "Fourth quarter:";
cin>>east.q4;
cout<<"Enter quarterly sales for West division"<<endl;
west.name="west";
cout<< "First quarter:";
cin>>west.q1;
cout<< "Second quarter:";
cin>>west.q2;
cout<< "Third quarter:";
cin>>west.q3;
cout<< "Fourth quarter:";
cin>>west.q4;
cout<<"Enter quarterly sales for North division"<<endl;
north.name="north";
cout<< "First quarter:";
cin>>north.q1;
cout<< "Second quarter:";
cin>>north.q2;
cout<< "Third quarter:";
cin>>north.q3;
cout<< "Fourth quarter:";
cin>>north.q4;
cout<<"Enter quarterly sales for South division"<<endl;
south.name="south";
cout<< "First quarter:";
cin>>south.q1;
cout<< "Second quarter:";
cin>>south.q2;
cout<< "Third quarter:";
cin>>south.q3;
cout<< "Fourth quarter:";
cin>>south.q4;
DisplayCorpInformation(east,west,north,south);
FindTotalAndAverageSales(east);
FindTotalAndAverageSales(west);
FindTotalAndAverageSales(north);
FindTotalAndAverageSales(south);
return 0;
}
//method that finds the Annual and average sales
void FindTotalAndAverageSales(Division& div)
{
cout<<"sales of division"<<endl;
double sales=div.q1+div.q2+div.q3+div.q4;
cout<<"Total sales:"<<sales<<endl;
cout<<"Average sales:"<<sales/4<<endl;
}
//method that display the information with respect to division
void DisplayCorpInformation(const Division& east, const Division& west, const Division& north, const Division& south)
{
cout<<"Sales of "<<east.name<<endl;
cout<< "First quarter:"<<east.q1<<endl;
cout<< "Second quarter:"<<east.q2<<endl;
cout<< "Third quarter:"<<east.q3<<endl;
cout<< "fourth quarter:"<<east.q4<<endl;
cout<<"Sales of "<<west.name<<endl;
cout<< "First quarter:"<<west.q1<<endl;
cout<< "Second quarter:"<<west.q2<<endl;
cout<< "Third quarter:"<<west.q3<<endl;
cout<< "fourth quarter:"<<west.q4<<endl;
cout<<"Sales of "<<north.name<<endl;
cout<< "First quarter:"<<north.q1<<endl;
cout<< "Second quarter:"<<north.q2<<endl;
cout<< "Third quarter:"<<north.q3<<endl;
cout<< "fourth quarter:"<<north.q4<<endl;
cout<<"Sales of "<<south.name<<endl;
cout<< "First quarter:"<<south.q1<<endl;
cout<< "Second quarter:"<<south.q2<<endl;
cout<< "Third quarter:"<<south.q3<<endl;
cout<< "fourth quarter:"<<south.q4<<endl;

}