//Andrew Alspaugh                CS1A                Chapter 7. P. 444. #3.
 
/****************************************************************************
 * Produce Salsa Sales Report
 * __________________________________________________________________________
 * The Purpose of this program is to diplsay how many jars of each type were 
 * sold. This program also displays the total number of jars sold. Once the 
 * total jars have been calculated, the program finishes by displaying 
 * the most and least sold type of salsa
 * ___________________________________________________________________________
 * INPUT
 *	TYPE      Array Size 
 *  SALSA[]   Array holding Salsa Types (STRING)
 *  SALES[]   Array holding number of jars sold (INPUT INT)
 *  
 *OUTPUT
 *  salesTotal   Accumulates number of jars sold
 * 
 *  highest      highest number of jars sold
 *  highestTYPE  name of most jars sold
 * 
 *  lowest       lowest number of jars sold
 *  lowestTYPE   name of least jars sold
 *  
 ****************************************************************************/
 
#include <iostream>
#include <string>
using namespace std;
 
int main() 
{
//DATA DICTIONARY
 
    //INPUT ARRAY SALSA TYPES
	const int TYPE = 5;
	string SALSA[TYPE] = {"Mild", "Medium", "Sweet", "Hot", "Zesty" };
 
	//INPUT ARRAY NUMBER OF JARS SOLD
	int SALES[TYPE];
 
	//OUTPUT // ACCUMULATE TOTAL SALES
	int salesTotal= 0;
 
	//OUTPUT HIGHEST SALES JARS
	int highest = 0;
 
	//OUTPUT HIGHEST SALES SALSA
	int highestTYPE;
 
	//OUPTPUT LOWEST SALES JARS
	int lowest = 0;
 
	//OUTPUT LOWEST SALES SALSA
	int lowestTYPE;
 
 
//INPUT
	//INPUT NUMBER OF JARS SOLD
	for(int count = 0; count < TYPE; count++)
	{
		cout << "Enter Number Of Jars Sold For " << SALSA[count] << endl;
		cin >> SALES[count];
 
		while(SALES[count] < 0)
		{
		     cout << "INVALID: NUMBER CANNOT BE NEGATIVE" << endl;
		     cin >> SALES[count];
		}
		//ACCUMULATOR
		salesTotal += SALES[count];
	}
 
//PROCESS 
 
	highest = SALES[0];
	for (int count = 1; count < TYPE; count++)
	{
		if(SALES[count] > highest)
		{
			highest = SALES[count];
			highestTYPE = count;
		}
	}
 
	lowest = SALES[0];
	for (int count = 1; count < TYPE; count++)
	{
		if(SALES[count] < lowest)
		{
			lowest = SALES[count];
			lowestTYPE = count;
		}
	}
 
 
//OUTPUT
 
	cout << endl << endl;
	cout << "SALSA SALES REPORT" << endl << endl;
 
	for (int count = 0; count < TYPE; count++)
	{
		cout << SALSA[count] << "\t\t\t" << SALES[count] << endl;
 
	}
 
	cout << "Total Sold " << salesTotal << endl;
 
	cout << "The Most Sold Type is: " << SALSA[highestTYPE] << endl;
 
	cout << "Least Sold Type is: " << SALSA[lowestTYPE] << endl;
	return 0;
	}