//Roman Lara Delgado CSC5 Chapter 7, P.444, #3
//
/*******************************************************************************
*
* Report Salsa Sales
*_______________________________________________________________________________
* This program calculates total jars sales of salsas then determines the salsas
* with the highest and lowest sales.
* ______________________________________________________________________________
* INPUT
* jars[] : The amount of jars sold for each salsa.
*
* OUTPUT
* totalSales : amount of total salsa jar sales
* highestSalsaName : name of best selling salsa
* lowestSalsaName : ame of least selling salsa
*******************************************************************************/
#include <iostream>
#include <string>
using namespace std;
int main ()
{
/***************************************************************************
* CONSTANTS
* -------------------------------------------------------------------------
* SALSAS : Number of different salsas
* ************************************************************************/
//Initialize Program Constants
const int SALSAS = 5; //CONSTANT - Number of different salsas
//Delcare Program Variables
int jars[SALSAS]; //INPUT - jar sales for each salsa
//Salsa Names
string nameSalsa[SALSAS] = {"mild", "medium", "sweet", "hot", "zesty"};
int totalSales = 0; //CALC - amount of total salsa jar sales
int highestSalsa; //CALC - highest salsa jars sold
int lowestSalsa; //CALC - highest salsa jars sold
string highestSalsaName; //OUTPUT - name of best selling salsa
string lowestSalsaName; //OUTPUT - name of least selling salsa
//Input Salsa Jar Sales
for (int count = 0; count < SALSAS; count++)
{
cout << "Enter number of " << nameSalsa[count];
cout << " salsa jars sold last month: ";
cin >> jars[count];
cout << endl;
totalSales += jars[count];
}
highestSalsaName = nameSalsa[0];
highestSalsa = jars[0];
//Determine Highest Selling Salsa
for (int count = 1; count < SALSAS; count++)
{
if (jars[count] > highestSalsa)
{
highestSalsa = jars[count];
highestSalsaName = nameSalsa[count];
}
}
lowestSalsaName = nameSalsa[0];
lowestSalsa = jars[0];
//Determine Lowest Selling Salsa
for (int count = 1; count < SALSAS; count++)
{
if (jars[count] < lowestSalsa)
{
lowestSalsa = jars[count];
lowestSalsaName = nameSalsa[count];
}
}
cout << endl;
//Output Total Individual Jars Sales Last Month
for (int count = 0; count < SALSAS; count++)
{
cout << "Total amount of " << nameSalsa[count];
cout << " salsa jars sold last month was " << jars[count] << ".";
cout << endl;
}
//Output Total Jars Sales Last Month
cout << endl;
cout << "The total amount of salsa jars sold last month was " << totalSales;
cout << " jars." << endl;
//Output Best Selling Salsa
cout << "The best selling salsa in the last month was " << highestSalsaName;
cout << " with " << highestSalsa << " jars sold." << endl;
//Output Lowest Selling Salsa
cout << "The lowest Salsa sold in the last month was " << lowestSalsaName;
cout << " with " << lowestSalsa << " jars sold." << endl;
return 0;
}