Corporate Data Sales

Corporate Data Sales

Write a program that uses a structure named CorpData to store the following information on a company division.

Division Name(North, South, East, Or West)
First quarter sales
Second quarter sales
Third quarter sales
Fourth quarter sales
Total annual sales
Average quarter sales

Include a constructor that allows the division name and four quarterly sales amounts to be specified at the time a CorpData variable is created.

The program should create four variables of this structure, each representing one of the following corporate divisions: North, South, East and West. Each variable should be passed in turn to a function that calculates and stores the total annual sales and average sales for that division.

Once this has been done for each division, each variable should be passed in turn to a function that displays the division name, total sales, and average sales.

Anybody know how I can fix the errors? Please let me know!!
Thanks!

Here is my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

struct CorpData
{
	private:
		string name;

		double FirstQuartSales,
			  SecondQuartSales,
			  ThirdQuartSales,
			  FourthQuartSales,
			  TotalAnnualSales,
			  AvgQuartSales;
	public:

		void storeData(string n, double a, double b, double c, double d);
		void getData();
		void findTotal();
		void findAverage();
		void displayData();
};

void CorpData::storeData(string n, double a, double b, double c, double d)
{
	name = n;
	FirstQuartSales = a;
	SecondQuartSales = b;
	ThirdQuartSales = c;
	FourthQuartSales = d;
}

void CorpData::getData()
{
	cout << "North Division" << endl;
	cout << "Enter first quarterly amount: $";
	cin >> north.FirstQuartSales;
	cout << "Enter second quarterly amount: $";
	cin >> north.SecondQuartSales;
	cout << "Enter third quarterly amount: ";
	cin >> north.ThirdQuartSales;
	cout << "Enter fourth quarterly amount: ";
	cin >> north.FourthQuartSales;

	cout << "\nSouth Division" << endl;
	cout << "Enter first quarterly amount: $";
	cin >> south.FirstQuartSales;
	cout << "Enter second quarterly amount: $";
	cin >> south.SecondQuartSales;
	cout << "Enter third quarterly amount: ";
	cin >> south.ThirdQuartSales;
	cout << "Enter fourth quarterly amount: ";
	cin >> south.FourthQuartSales;

	cout << "\nEast Division" << endl;
	cout << "Enter first quarterly amount: $";
	cin >> east.FirstQuartSales;
	cout << "Enter second quarterly amount: $";
	cin >> east.SecondQuartSales;
	cout << "Enter third quarterly amount: ";
	cin >> east.ThirdQuartSales;
	cout << "Enter fourth quarterly amount: ";
	cin >> east.FourthQuartSales;

	cout << "\nWest Division" << endl;
	cout << "Enter first quarterly amount: $";
	cin >> west.FirstQuartSales;
	cout << "Enter second quarterly amount: $";
	cin >> west.SecondQuartSales;
	cout << "Enter third quarterly amount: ";
	cin >> west.ThirdQuartSales;
	cout << "Enter fourth quarterly amount: ";
	cin >> west.FourthQuartSales;

	findTotal();
	findAverage();
	displayData();
}

int main()
{
	cout << "This calculates and displays quarterlys.\n\n";

    return 0;
}

Your getData() function should not be for a specific division. Re-write it, but without north. or west. or anything like that, and no mentions of divisions. In main(), have it create four objects: CorpData north, south, east and west. From there, call getData() for each structure.
Topic archived. No new replies allowed.