p.s. I don't want to play the riddles game, nor do I want you to write the program for me. Just point me in the right direction. If you think I'm trying to get code written for me just ignore this post. You are not obligated to help.
Thanks
/********************************
* SalesSummary.cpp
* Luis Silva
*
*********************INSTRUCTIONS******************************
* Use a two-dimmensional array sales to store all total sales
* A company has salesperson 1-4 who sale products 1-5
* Once a day they report their sales passing a slip containing:
a) The salesperson number
B)/> The product number
c) The total value of the product sold that day
* Assuming last month's information is available, write a program that
summarizes the total sales by salesperson by product.
* After processing all info print it in a tabular format with
columns = salesperson and rows = products.
* Print totals at the end of columns and rows
**************************OUTPUT*****************************
Salesman 1 Salesman 2 Salesman 3 Salesman 4 Total
Product 1 5 3 4 1 $34.00
Product 2 1 3 2 4 $210.00
Product 3 0 2 1 1 $94.00
Product 4 3 4 2 1 $100.00
Product 5 2 1 3 5 $111.00
Total 11 13 12 12
*************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
#include "salessummary.h"
//Constructor
SalesSummary::SalesSummary(const int salesArray[][salesmen])
{
for ( int product = 0; product < products; product++ )
for( int salesman = 0; salesman < salesmen; salesman++ )
sales[products][salesmen] = salesArray[products][salesmen];
}// end constructor
int SalesSummary::getTotalQty()
{
}//end getTotalQty
int SalesSummary::getTotalValue(const int*, int)
{
}//end getTotalValue
void SalesSummary::outputSales()
{
cout << "\t ";
for (int salespeople = 0; salespeople < salesmen; salespeople++)
cout << "Salesman " << setw(2) << salespeople + 1 << " ";
cout << " Total " << endl;
for (int prod = 0; prod < products; prod++)
cout << "Product " << setw(2) << prod + 1;
for (int salespeople = 0; salespeople < salesmen; salespeople++)
cout << setw(8) << sales[products][salesmen];
cout << endl;
cout << " Total " << endl;
}
/********************************
* main.cpp
* Luis Silva
*
* main file to run class and header
*************************************************************/
#include "salessummary.h"
using namespace std;
int main()
{
int salesArray[SalesSummary::products][SalesSummary::salesmen] = {{5, 3, 4, 1},
{1, 3, 2, 4},
{0, 2, 1, 1},
{3, 4, 2, 1},
{2, 1, 3, 5}};
SalesSummary Summary(salesArray);
Summary.outputSales();
//cout << salesArray << endl;
return 0;
}
/***************************
* SalesSummary.h
* Luis Silva
*
* header file for SalesSummary. cpp
****************************/
#ifndef SALESSUMMARY_H
#define SALESSUMMARY_H
#include <string>
using namespace std;
class SalesSummary
{
public:
//constants
static const int products = 5;
static const int salesmen = 4;
SalesSummary(const int [][salesmen]);
int getTotalQty();
int getTotalValue(const int [], const int);
void outputSales();
private:
int sales[products][salesmen];
};//end class
#endif // SALESSUMMARY_H

New Topic/Question
Reply



MultiQuote





|