Write a program that produces a sales report for a salsa maker who markets 5 typ
ID: 3778924 • Letter: W
Question
Write a program that produces a sales report for a salsa maker who markets 5 types of salsa ("mild ", "medium", "sweet ", "hot ", "zesty "). The program includes total sales for all products and identifies the highest and lowest selling product (Assuming each jar is $4). It generates a report: Name Jars Sold _______________________ Mild 10 Medium 20 . . . At the end of this report it will show below items: Total sales: High Seller: Low Seller: Two parallel arrays are used to store the salsa names (Mild, Medium, etc.) and quantities sold of each (prompt user).Using c++ Write a program that produces a sales report for a salsa maker who markets 5 types of salsa ("mild ", "medium", "sweet ", "hot ", "zesty "). The program includes total sales for all products and identifies the highest and lowest selling product (Assuming each jar is $4). It generates a report: Name Jars Sold _______________________ Mild 10 Medium 20 . . . At the end of this report it will show below items: Total sales: High Seller: Low Seller: Two parallel arrays are used to store the salsa names (Mild, Medium, etc.) and quantities sold of each (prompt user).
Using c++
Using c++
Explanation / Answer
#include <iostream>
#include <string>
using namespace std;
int main()
{
string a[]={"mild", "medium", "sweet", "hot", "zesty"};
int b[5];
for(int i=0;i<5;i++)
{
cout<<"Enter the number of jars sold for "<<a[i]<<" salsa:";
cin>>b[i];
}
int max=0;
int min=0;
cout<<"Name Jars Sold"<<endl;
for(int i=0;i<5;i++)
{
if(b[max]<b[i])
{
max=i;
}
if(b[min]>b[i])
{
min=i;
}
cout<<a[i]<<' '<<b[i]<<endl;
}
cout<<"High Seller: "<<a[max]<<" "<<b[max]<<endl;
cout<<"Low Seller: "<<a[min]<<" "<<b[min]<<endl;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.