NEED HELP ASAP!

closed account (LE8p216C)
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!
Last edited on
Hello goofie123,

I would start with this:

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.

Andy
Hello goofie123,

Finished mine. How far did you get?

Andy
closed account (LE8p216C)
Hello Andy,

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.
I have everything done except....

How about showing us what you've done so far then? Post the code, using code tags to make your source easier to read and comment on.

could you send me what you did

So you want someone not you to do YOUR assignment? So you can take credit for it?
Hello goofie123,

Better to post what you have done and learn what is wrong with it then learn from it.

Show what YOU have done or people will get tired of thinking you want them to do your work and then you could end up with nothing.

Andy
closed account (LE8p216C)
#include <iostream>
using namespace std;

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;
}
Topic archived. No new replies allowed.