Structure of the Problem Requirements
Write a Programmed in C++ for a Sales Company, In Which
1: Company can check the Record of all the Products which is Sale in Month or Year
2: Company can easily fine which product sale is maximum or minimum during time period
3: Include all the miscellaneous Charges in the Programmed
4: Include the Pay of Shop Keeper and then calculate the total of Products Sales Which decide weather the Company goes in loss or profit
SOURCE CODE
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>
//#include <graphics.h>
using namespace std;
int main()
{
system("color 5a");
//Sleep ( 500 );
cout<<"Name: Sales Company Budget Sheet \n"
<<"Copyright: 2012 \n"
<<"Author: www.ancodingpoint.com \n"
<<"CMS NO: 1234 \n"
<<"Date Modified: 03/11/12 20:18 \n";
char answer;
do
{
/*================================================================
DECLARING VARIABLES
================================================================*/
const int rows=10,column=2;
float elecBill,employeePay,miscCharges;
string productNames[rows]={"Nido Milk","KitKat Choc","Chicken Soy","Fruit Candy","Mineral Water",
"Nestle Juice","Coca Cola","Chat Masala","Coco Powder","Custard"};
float productPrices[rows][column]={{550,531.2},{20,17.5},{50,43},{25,22},{60,51},
{90,78},{80,75},{45,39.9},{75,68},{150,135}};
int quantityOfProducts[rows],totalSold=0,popular=0,worst=0;
float profitArray[rows],profitPercent[rows],totalAmount=0,totalProfit=0,totalBudget;
/*================================================================
PRODUCTS LIST
================================================================*/
cout<<"\n\t\t=============================================="<<endl;
cout<<"\t\t\t\tPRODUCTS LIST"<<endl;
cout<<"\t\t=============================================="<<endl;
cout<<endl;
cout<<"\t\t"<<"|----------------|-------------|-------------|"<<endl;
cout<<"\t\t"<<"| Product Names |"<<setw(10)<<"Retail Price |"<<setw(10)<<"Orignal Price|"<<endl;
cout<<"\t\t"<<"|----------------|-------------|-------------|"<<endl;
for(int i=0;i<rows;i++)
{
cout<<"\t\t"<<"|"<<setw(13)<<productNames[i]<<setw(4)<<"|";
for(int j=0;j<column;j++)
{
cout<<setw(7)<<productPrices[i][j]<<setw(7)<<"|";
}
cout<<endl;
cout<<"\t\t"<<"|................|.............|.............|"<<endl;
}
/*==============================================================
MONTHLY ELECTRICITY BILL,EMPLOYEE MONTHLY PAY,MISC CHARGES
================================================================*/
cout<<"\nEnter Monthly Electricity Bill: ";
cin>>elecBill;
cout<<"\nEnter Employee Monthly Pay: ";
cin>>employeePay;
cout<<"\nEnter Miscellaneous Charges: ";
cin>>miscCharges;
/*==============================================================
PROFIT ARRAY
==============================================================*/
for(int l=0;l<rows;l++)
{
profitArray[l]=productPrices[l][0]-productPrices[l][1];
profitPercent[l]=(profitArray[l]*100)/productPrices[l][0];
}
/*==============================================================
QUANTITY OF PRODUCTS SOLD,PROFIT WITH QUANTITY OF PRODUCTS,
TOTAL AMOUNT AND TOTAL PROFIT RECEIVE, POPULAR AND WORST PRODUCT
================================================================*/
float temp1=profitPercent[0],temp2=profitPercent[0];
for(int k=0;k<rows;k++)
{
cout<<"\nEnter Quantity of "<<productNames[k]<<" Sold in the Month: ";
cin>>quantityOfProducts[k];
totalSold+=quantityOfProducts[k];
profitArray[k]=profitArray[k]*quantityOfProducts[k];
totalProfit+=profitArray[k];
totalAmount+=quantityOfProducts[k]*productPrices[k][0];
if(profitPercent[k]>temp1)
{
temp1=profitPercent[k];
}
else if(profitPercent[k]<temp2)
{
temp2=profitPercent[k];
}
}
for(int m=0;m<rows;m++)
{
if(temp1==profitPercent[m])
{
popular=m;
}
if(temp2==profitPercent[m] || quantityOfProducts[m]==0)
{
worst=m;
}
}
/*==============================================================
BUDGET SHEET
================================================================*/
cout<<"\n\t\t==============================================="<<endl;
cout<<"\t\t\t\tBUDGET SHEET"<<endl;
cout<<"\t\t==============================================="<<endl;
cout<<endl;
cout<<"\t\t|----------------|--------------|-------------|"<<endl;
cout<<"\t\t| Product Names |"<<setw(10)<<"Quantity Sold |"<<setw(10)<<"Profit"<<setw(4)<<"|"<<endl;
cout<<"\t\t|----------------|--------------|-------------|"<<endl;
for(int n=0;n<rows;n++)
{
cout<<"\t\t|"<<setw(13)<<productNames[n]<<setw(4)<<"|";
cout<<setw(8)<<quantityOfProducts[n]<<setw(7)<<"|";
cout<<setw(8)<<profitArray[n]<<" Rs"<<setw(3)<<"|"<<endl;
cout<<"\t\t"<<"|................|..............|.............|"<<endl;
}
totalBudget=totalAmount-(elecBill+employeePay+miscCharges);
cout<<"\n\t\t\tTotal Products Sold = "<<totalSold<<endl;
cout<<"\n\t\t\tTotal Amount Received = "<<totalAmount<<" Rupees"<<endl;
if(totalBudget>(totalAmount-totalProfit))
{
cout<<"\n\t\t\tTotal Profit = "<<totalProfit<<" Rupees"<<endl;
}
else
{
cout<<"\n\t\t\tTotal Loss = "<<(totalAmount-totalProfit)-totalBudget<<" Rupees"<<endl;
}
cout<<"\n\t\t\tPopular Product: "<<productNames[popular]<<endl;
cout<<"\n\t\t\tWorst Product: "<<productNames[worst]<<endl;
cout<<"\n\t\t\tTOTAL BUDGET = "<<totalBudget<<" Rupees"<<endl;
cout<<"\nDo you want to continue (y/n): ";
cin>>answer;
}while(tolower(answer=='y'));
system("pause");
return 0;
}
OUTPUT OF THE PROGRAM
| Sales Company System |
| Sales Company System |
