-
Notifications
You must be signed in to change notification settings - Fork 0
/
05ITEM.CPP
57 lines (53 loc) · 941 Bytes
/
05ITEM.CPP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class item
{
private :
int icode,quantity;
char iname[25];
float price,offer,dis,total;
float getoffer(int quantity)
{
if (quantity<=50)
offer=0;
else if (quantity>50&&quantity<=100)
offer=(0.05*total);
else
offer=(0.1*total);
return (offer);
}
public :
void getstock();
void showitem();
};
void item::getstock()
{
clrscr();
cout<<"Enter Itemcode : ";
cin>>icode;
cout<<"\nEnter Item Name : ";
gets(iname);
cout<<"\nEnter Price Per Piece : ";
cin>>price;
cout<<"\nEnter Quantity : ";
cin>>quantity;
float a=(price*quantity);
dis=getoffer(quantity);
total=a-dis;
}
void item::showitem()
{
clrscr();
cout<<"Item Code : "<<icode<<endl;
cout<<"Item Name : "<<iname<<endl;
cout<<"Total Bill : "<<total<<endl;
}
void main()
{
clrscr();
item i;
i.getstock();
i.showitem();
getch();
}