CIS170C Programming Salsa Sales Report Program DeVry University
- Description
- Full Document
DeVry University
CIS170C Programming Salsa Sales Report Program DeVry University
(1) Code
// —————————————————————
// Programming Assignment: LAB3
// Developer: Student
// Date Written: 07/19/2017
// Purpose: Salsa Sales Report Program
// —————————————————————
#include<iostream>
#include<string>
using namespace std;
int main()
{
//Declare Variables
string salsa_name[7] = { “mild”,”medium”,”hot”,”sweet”,”fruit”,”verde”,”zesty” };//Array
for salsa names
int sales[7] = { 0,0,0,0,0,0,0 };//Array for number of salsa jars sold during past month
int i, total = 0, high = 0, hiSalesProduct = 0, low = 0, lowSalesProduct = 0, temp = 0;
cout << “Welcome to the Salsa Sales Report Program\n”;
{
while (temp <= 0) //Loop to get input for sales of each salsa
{
cout << “Jars sold last month of ” << salsa_name[i] << “: “;
cin >> temp;
if (temp <= 0) //Input validation
cout << “invalid data. please try again\n”;
}
sales[i] = temp;
temp = 0;
}
cout << “\nSalsa Sales Report\n”; //Title of report
cout << “\n name\t jars sold\n”; //Sub titles
cout << “———————\n”;
for (i = 0; i<7; i++) //Loop to calculate total jars sold
{
cout << ” ” << salsa_name[i] << “\t\t” << sales[i] << “\n”;
}
low = sales[0];
for (i = 0; i<7; i++)
{
total = total + sales[i];
if (sales[i] >= high)
{
hiSalesProduct = i;
high = sales[i];
}
if (sales[i] <= low)
{
lowSalesProduct = i;
low = sales[i];
}
}
cout << “\nTotal Sales : ” << total; //Output total sales
cout << “\nHigh Seller : ” << salsa_name[hiSalesProduct]; //Output highest seller
cout << “\nLow Seller : ” << salsa_name[lowSalesProduct]; //Output lowest seller
cout << “\nPress any key to continue.” << endl;
cin.get();
cin.get();
return 0;
}
Preview

