Write a program that lets a Chips and Salsa company keep track of sales for their 5 different types of salsa (Mild, Medium, Sweet, Hot, Zesty). Use a loop to ask the number of jars sold for each type (5 times). Validate that a negative number is not entered. Still within the loop, calculate the Total Jars sold, highest and lowest amount sold.
Write a function that gets called out of MAIN. In that function, display Total Jars, Average Jars Sold, Highest Amount of Jars Sold, and Lowest Amount of Jars Sold.
Need help doing this in the most basic form ever I have tried arrays and that is way beyond what we are learning I would like help to simplify it to the max!
Write a program that lets a Chips and Salsa company keep track of sales for their 5 different
types of salsa (Mild, Medium, Sweet, Hot, Zesty).
Use a loop to ask the number of jars sold for each type (5 times).
You wrote:
I have tried arrays and that is way beyond what we are learning
Since this is a program that could benefit from arrays an even a struct. My question is why are you given this program at this time?. Unless there is something in the instructions that is missing like what the program is being used to cover?
If you have not planned out the program before you start writing it then it is best to work in small steps. Compile often and test when you need to.
Work on getting the input to be the way that you want. Until you have some numbers to work with the rest of the program is kind of pointless right now.
Get the input working and think about dealing with the negative number part, but save that for later.
When you get some code post it so everyone can see what you have done.
I have everything done except how it figures out the lowest and highest because I am unsure how to use arrays could you send me what you did instead of the arrays I'm really struggling and been working on this for days.
void findLarge (int salsa[], int limit);
void findLow (int salsa[], int limit);
void totalSale (int total[], int limit);
int main()
{
}
void totalSale (int total[], int limit)
{
int total;
int super,mild,medium,sweet,hot,zesty;
for(total=0; total<5; total++)
super=mild+medium+sweet+hot+zesty;
cout<<"The average is "<<super;
}
void findLarge (int salsa[], int limit)
{
int largest;
largest = salsa[0];
for(int x=0; x<limit; x++)
{
if (salsa[x]>largest)
largest=salsa[x];
}
cout<<"The largest salsa sold is "<<largest<<endl;
}
void findLow (int salsa[], int limit)
{
int lowest;
lowest = salsa[0];
for(int x=0; x<limit; x++)
{
if (salsa[x]>lowest)
lowest=salsa[x];
}
cout<<"The lowest salsa sold is "<<lowest<<endl;
}