Feb 22, 2018 at 3:13pm UTC
#include <iostream>
#include <stdlib.h>
using namespace std;
class customer
{
private :
int customer_no;
char customer_name[20];
int qty;
float price,totalprice,discount,netprice;
public:
customer(){customer_no=111;customer_name[20]='leena';qty=0;price=0;netprice=0;}
void input();
void caldiscount();
void show();
};
void customer ::input()
{
cout<<"ENTER CUSTOMER NAME - ";
cin>>customer_name;
cout<<"ENTER QUANTITY OF GOODS - ";
cin>>qty;
cout<<"ENTER PRICE OF GOODS - ";
cin>>price;
system("CLS");
}
void customer ::caldiscount()
{
totalprice = price*qty;
if(totalprice>=50000)
{
discount = (25/100)*totalprice;
}
else if(totalprice>=25000&&totalprice<50000)
{
discount = (15/100)*totalprice;
}
else if(totalprice<25000)
{
discount = (10/100)*totalprice;
}
netprice = totalprice-discount;
}
void customer :: show()
{
cout<<"CUSTOMER_NAME - ";
cout<<customer_name<<endl;
cout<<"QUANTITY OF GOODS - ";
cout<<qty<<endl;
cout<<"PRICE OF GOODS - ";
cout<<price<<endl;
cout<<"TOTAL PRICE - ";
cout<<totalprice<<endl;
cout<<"DISCOUNT AMOUNT - ";
cout<<discount<<endl;
cout<<"NET PRICE OF GOODS - ";
cout<<netprice;
}
int main()
{
customer info;
cout<<"WELCOME TO KAUSTUBH STORES"<<endl;
info.input();
cout<<"DETAILS"<<endl;
info.caldiscount();
info.show();
}