-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6.cpp
More file actions
35 lines (29 loc) · 786 Bytes
/
6.cpp
File metadata and controls
35 lines (29 loc) · 786 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
#include <iostream>
using namespace std;
class TelephoneBill {
string name;
string address;
long long telNo;
int numCalls;
public:
void input() {
cout<<"Enter Name,Address,Telephone no. and number of calls : "<<endl;
cin >> name >> address >> telNo >> numCalls;
}
void display() {
cout << "Name: " << name << "\n";
cout << "Address: " << address << "\n";
cout << "Telephone No.: " << telNo << "\n";
cout << "Number of Calls: " << numCalls << "\n";
}
friend float computeBill(TelephoneBill t);
};
float computeBill(TelephoneBill t) {
return t.numCalls * 2.0;
}
int main() {
TelephoneBill t1;
t1.input();
t1.display();
cout << "Total Amount : Rs. " << computeBill(t1) <<endl;
}