//Ryan Shahriyarpour   CS1A    Carl Argila CH7 HW question 3
/*****************************************************************************
 *
 * Chips and Salsa
 *
 *********************
 *
 * This program uses two parallel arrays to track
 * sales of five salsa types. It displays the sales for each type, the total
 * sales, and the highest and lowest selling salsa. 
 * 
 * **********
 * INPUT
 *  Number of jars sold for each salsa type
 *
 * OUTPUT
 *  Sales for each type, total sales, highest seller, lowest seller
 ****************************************************************************/
 
#include <iostream>
#include <string>
using namespace std;
 
const int SIZE = 5;
 
int main()
{
    string names[SIZE] = {"mild", "medium", "sweet", "hot", "zesty"};
    int jars[SIZE];
    int total = 0;
    int high = 0;
    int low = 0;
 
    // Input (no negative numbers allowed)
    for (int i = 0; i < SIZE; i++)
    {
        cout << "Enter jars sold for " << names[i] << ": ";
        cin >> jars[i];
        while (jars[i] < 0)
        {
            cout << "Cannot be negative. Re-enter: ";
            cin >> jars[i];
        }
    }
 
    // Add up the total and find the highest and lowest sellers
    for (int i = 0; i < SIZE; i++)
    {
        total = total + jars[i];
        if (jars[i] > jars[high])
            high = i;
        if (jars[i] < jars[low])
            low = i;
    }
 
    // Output
    cout << "\nSales Report\n";
    for (int i = 0; i < SIZE; i++)
        cout << names[i] << ": " << jars[i] << " jars" << endl;
    cout << "Total sales: " << total << " jars" << endl;
    cout << "Highest selling: " << names[high] << endl;
    cout << "Lowest selling: " << names[low] << endl;
 
    return 0;
}