// Include custom header files
#include "DivSales.h"

int main() { // Start main function

	int numDivisions = 4; // Integer to store number of corporate divisions (according to program specifications)
	
	// Declare vector of type DivSales
	vector<DivSales> corpSales;
	
	// Variables to store user input for quarter sales
	double q1;
	double q2;
	double q3;
	double q4;

	// Loop for entering quarter sales value of each division
	for (int i = 1; i <= numDivisions; i++) {
		// Prompt user to enter sales data for the current division
		cout << "Enter sales data for Division " << i << endl;
		
		// Prompt user to enter quarter 1 sales
		cout << "Quarter 1: ";
		cin >> q1;
		while (q1 < 0) { // Validate that user input is greater than zero
			cout << "Please enter 0 or greater: ";
			cin >> q1;
		}
		// Prompt user to enter quarter 1 sales
		cout << "Quarter 2: ";
		cin >> q2;
		while (q2 < 0) { // Validate that user input is greater than zero
                        cout << "Please enter 0 or greater: ";
                        cin >> q2;
                }
                // Prompt user to enter quarter 1 sales
		cout << "Quarter 3: ";
		cin >> q3;
		while (q3 < 0) { // Validate that user input is greater than zero
                        cout << "Please enter 0 or greater: ";
                        cin >> q3;
                }
                // Prompt user to enter quarter 1 sales
		cout << "Quarter 4: ";
		cin >> q4;
		while (q4 < 0) { // Validate that user input is greater than zero
                        cout << "Please enter 0 or greater: ";
                        cin >> q4;
                }
                
                // Add object to vector by calling DivSales constructor (which, in turn, calls setSales())
		corpSales.push_back(DivSales(q1, q2, q3, q4));
	}

	// Loop for printing a division's yearly sales
	for (int i = 0; i < numDivisions; i++) {
		cout << setprecision(2) << fixed << "Total Sales for Division " << i << ": $" << corpSales[i].getDivSales() << endl; // Print with two decimal points
	}

	// Print total corporate sales
	cout << setprecision(2) << fixed << "Total Corporate Sales: $" << corpSales[0].getCorpSales() << endl; // Print with two decimal points

	return 0; // Return end code

}
