Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

basic C++ program, thank you. 1: Create a string array that stores five differen

ID: 3741536 • Letter: B

Question

basic C++ program, thank you.

1: Create a string array that stores five different types of salsas: mild, medium, sweet, hot, and zesty.

2:The salsa names should be stored using an initialization list at the time the name array is created. (3 points) ?

3:Have the program prompt the user to enter the number of salsa jars sold for each type of salsa using an array. Do not accept negative values for the number of jars sold. (4 points) ?

4:Produce a table that displays the sales for each type of salsa (2 points),

5: the total sales (2 points), and the names of the highest selling and lowest selling products (4 points).

Explanation / Answer

#include <iostream>

#include <string>

#include <stdio.h>

#define MAX_ITEMS 5

using namespace std;

void report(string salsa[], int sales[])

{

cout<< "Name : Jars Sold "<<endl;

cout << "~~~~~~~~~~~~~~~~~~~~"<<endl;

for(int i=0;i<MAX_ITEMS;i++)

{

cout<<salsa [i] << " : "<<sales[i] <<endl;

}

}

int main()

{

string salsa[MAX_ITEMS] = {"mild","medium","sweet","hot","zesty"};

int sales[MAX_ITEMS] = {0};

int n, total = 0, min = -1, max = -1;

string str;

char ch,ch1;

for(int i=0; i<MAX_ITEMS; i++)

{

while(1)

{

cout << "Enter the sales for " << salsa[i] << " : ";

cin >> n;

if(n >= 0)

{

sales[i] = n;

if(min == -1 || min > n)

min = n;

if(max == -1 || max < n)

max = n;

total += n;

break;

}

}

}

report(salsa,sales);

cout << " Total sales : " << total << endl;

cout << "Lowest sales : " << min << endl;

cout << "Highest sales : " << max << endl;

return 0;

}