-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoop_tut04.cpp
More file actions
51 lines (37 loc) · 803 Bytes
/
oop_tut04.cpp
File metadata and controls
51 lines (37 loc) · 803 Bytes
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
#include <iostream>
using namespace std;
class discount
{
private:
double price, disc;
public:
void input(void);
void calculation(void);
void paid(void);
};
void discount ::input(void)
{
cout << "Enter the price of product " << endl;
cin >> price;
cout << "Enter the discount you want " << endl;
cin >> disc;
}
void discount ::calculation(void)
{
double total = disc / 100 * price;
cout << "The amount after " << disc << " % discount is " << total << endl;
}
void discount::paid(void)
{
double total = disc / 100 * price;
double paid = price - total;
cout << "The amount paid by customer is " << paid;
}
int main()
{
discount shoes;
shoes.input();
shoes.calculation();
shoes.paid();
return 0;
}