#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
class item{
protected:
char iname[45];
int icode,stock,re_order;
float price;
public:
void getitem(char in[], int ic, int s, int re, float p)
{
strcpy(iname,in);
icode=ic;
stock=s;
re_order=re;
price=p;
}
};
class order{
protected:
int quan,inum,custid;
char custname[45],date[11];
public:
void getorder(int q, int ino, int cid, char cn[], char d[])
{
quan=q;
inum=ino;
custid=cid;
strcpy(custname,cn);
strcpy(date,d);
}
};
class sales:public item, public order{
protected:
char dos[11];
public:
void salesmade(char ds[])
{
strcpy(dos,ds);
if(stock<=re_order||stock<quan)
cout<<"Insufficient Stock!!!";
else
{
cout<<"\n\t*****BILL*****\n\nItem's Details:";
cout<<"\nItem Name:"<<iname;
cout<<"\tItem Code: "<<icode;
cout<<"\nCurrent Stock= "<<stock;
cout<<"\tRe-order value= "<<re_order;
cout<<"\nCost of item=Rs."<<price<<"/unit\n";
cout<<"\nCustomer's Details:\n";
cout<<"Customer's Name: "<<custname;
cout<<"\tCustomer's ID: "<<custid;
cout<<"\nItem Number: "<<inum;
cout<<"\nNumber of item bought: "<<quan;
cout<<"\tOrder Date: "<<date;
cout<<"\nAmount Payable=Rs."<<quan*price;
cout<<"\t\tBilling Date: "<<dos<<endl;
}
}
};
void main()
{
char in[10],cn[45],d[11],ds[11];
int ic,s,re,cid,q,ino;
float p;
cout<<"\n\tEnter item's details:\nName:";
gets(in);
cout<<"Code:";
cin>>ic;
cout<<"Current Stock:";
cin>>s;
cout<<"Re-order value:";
cin>>re;
cout<<"Price per unit:";
cin>>p;
cout<<"\nEnter Customer's Details:\nName:";
gets(cn);
cout<<"Id:";
cin>>cid;
cout<<"Enter item number:";
cin>>ino;
cout<<"Enter number of item(s) bought:";
cin>>q;
cout<<"Enter order date (dd/mm/yyyy):";
gets(d);
cout<<"Enter billing date (dd/mm/yyyy):";
gets(ds);
sales ob;
ob.getitem(in,ic,s,re,p);
ob.getorder(q,ino,cid,cn,d);
ob.salesmade(ds);
getch();
clrscr();
}
#include<conio.h>
#include<stdio.h>
#include<string.h>
class item{
protected:
char iname[45];
int icode,stock,re_order;
float price;
public:
void getitem(char in[], int ic, int s, int re, float p)
{
strcpy(iname,in);
icode=ic;
stock=s;
re_order=re;
price=p;
}
};
class order{
protected:
int quan,inum,custid;
char custname[45],date[11];
public:
void getorder(int q, int ino, int cid, char cn[], char d[])
{
quan=q;
inum=ino;
custid=cid;
strcpy(custname,cn);
strcpy(date,d);
}
};
class sales:public item, public order{
protected:
char dos[11];
public:
void salesmade(char ds[])
{
strcpy(dos,ds);
if(stock<=re_order||stock<quan)
cout<<"Insufficient Stock!!!";
else
{
cout<<"\n\t*****BILL*****\n\nItem's Details:";
cout<<"\nItem Name:"<<iname;
cout<<"\tItem Code: "<<icode;
cout<<"\nCurrent Stock= "<<stock;
cout<<"\tRe-order value= "<<re_order;
cout<<"\nCost of item=Rs."<<price<<"/unit\n";
cout<<"\nCustomer's Details:\n";
cout<<"Customer's Name: "<<custname;
cout<<"\tCustomer's ID: "<<custid;
cout<<"\nItem Number: "<<inum;
cout<<"\nNumber of item bought: "<<quan;
cout<<"\tOrder Date: "<<date;
cout<<"\nAmount Payable=Rs."<<quan*price;
cout<<"\t\tBilling Date: "<<dos<<endl;
}
}
};
void main()
{
char in[10],cn[45],d[11],ds[11];
int ic,s,re,cid,q,ino;
float p;
cout<<"\n\tEnter item's details:\nName:";
gets(in);
cout<<"Code:";
cin>>ic;
cout<<"Current Stock:";
cin>>s;
cout<<"Re-order value:";
cin>>re;
cout<<"Price per unit:";
cin>>p;
cout<<"\nEnter Customer's Details:\nName:";
gets(cn);
cout<<"Id:";
cin>>cid;
cout<<"Enter item number:";
cin>>ino;
cout<<"Enter number of item(s) bought:";
cin>>q;
cout<<"Enter order date (dd/mm/yyyy):";
gets(d);
cout<<"Enter billing date (dd/mm/yyyy):";
gets(ds);
sales ob;
ob.getitem(in,ic,s,re,p);
ob.getorder(q,ino,cid,cn,d);
ob.salesmade(ds);
getch();
clrscr();
}
No comments:
Post a Comment