Thursday 7 August 2014

Write a C++ Programe for Sales Company

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


C++ Programming
Sales Company System

C++ Programming
Sales Company System








Share it Please
asad

About Author!

Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.

8 comments: Post Yours! Read Comment Policy!▼
Important Note:
We have Zero Tolerance to Spam. Chessy Comments and Comments with Links will be deleted immediately upon our review.

  1. Nice buddy.. You become Expert in Programming ... !!

    ReplyDelete
  2. This is Best if you do in Graphics

    ReplyDelete
    Replies
    1. Yes Brother but in Graphics section Programming we will added it very Soon this is beginner Level student Programmed who are not know about Graphics

      Delete
  3. Quick, click 'like'! They're clearly "the Biggest IT student community" and you can "become expert in Programming and Coding"

    ReplyDelete
  4. as a freshman cs student, this is incredibly similar to what our classwork looks like.
    also, is graphics.h a native cpp thing?

    ReplyDelete
    Replies
    1. Depends on Requirements ... Design not required

      Delete
  5. Quickly! We need more anchor tags! Link back to our own page randomly throughout the source code!
    Also, that color. :|
    Edit: Upon closer inspection, it's worse than I thought. Every new line of text is a div. ._.

    ReplyDelete