#include<iostream>
#include<string>
using namespace std;
class Invoice //here we make a class of name invoice
{
public: //this is the public part of the class
//here we declare the six data members
string part_number;
string description;
int item_quantity,item_price;
double value_addedtex;
double discount;
int tex;
Invoice() //this is the default constructure
{
value_addedtex=0.20;
discount=0;
part_number="";
description="";
item_quantity=0;
item_price=0;
}
Invoice(string x, string y,int u, int z ) //this is parameterized constructure
{
value_addedtex=0.20;
discount=0;
part_number=x;
description=y;
item_quantity=u;
item_price=z;
}
double getInvoiceAmount()
{
double amount;
tex=value_addedtex*item_price/100;
amount=item_quantity*item_price+tex-discount;
return amount;
}
};
int main()
{
string x,y;
int u,z;
Invoice no;
cout<<"please enter the part number";
cin>>x;
cout<<"please enter the part number";
cin>>y;
cout<<"please enter the part number";
cin>>u;
cout<<"please enter the part number";
cin>>z;
Invoice nu(x,y,u,z);
cout<<"tex in RS"<<nu.tex;
cout<<"amount will be:"<<nu.getInvoiceAmount()<<endl;
}
No comments:
Post a Comment