-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathChap3E3.cpp
42 lines (36 loc) · 874 Bytes
/
Chap3E3.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
#include<iostream>
using namespace std;
class Worker{
private:
char workername[25];
float hourworked;
float wagerate;
float totalwage;
float calcwage();
public:
void acceptvalues();
void displayvalues();
};
float Worker::calcwage()
{
return hourworked*wagerate;
}
void Worker::acceptvalues(){
cout<<"Enter the worker name:"<<endl;
cin>>workername;
cout<<"Time they worked:"<<endl;
cin>>hourworked;
cout<<"Enter wagerate :";
cin>>wagerate;
}
void Worker::displayvalues(){
cout<<"Enter the worker name:"<<workername<<endl;
cout<<"Time they worked:"<<hourworked<<endl;
cout<<"rate of wage:"<<wagerate<<endl;
cout<<"Enter the totalwage:"<<totalwage<<endl;
}
int main(){
Worker work;
work.acceptvalues();
work.displayvalues();
}