-
Notifications
You must be signed in to change notification settings - Fork 1
/
Exer3.1.cpp
77 lines (58 loc) · 1.44 KB
/
Exer3.1.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include<iostream>
#include<conio.h>
using namespace std;
int hrs;
float pack1(float hrs1);
float pack2(float hrs2);
void hours1()
{
int hours1;
cout<<"How many hours did you use it?"<<endl;
cin>>hrs;
cout<<endl;
cout<<"Monthly Bill: "<<pack1(hours1);
system("pause");
}
void hours2()
{
cout<<"How many hours did you use it?"<<endl;
cin>>hrs;
cout<<endl;
cout<<"Monthly Bill: "<<pack2(hours2);
system("pause");
}
float pack1(float hrs1) {
return (400+((hrs1-200)*30);
}
float pack2(float2) {
return (700+((hrs2-400)*20);
}
// Main function
void main()
{
int packageNum;
cout<<"\t\t\t Welcome to Malayan Internet Service Provider(MISP) "<<endl;
cout<<endl;
cout<<"Package 1:200 hours of access are provided for P400.00. Exceeding hours costs P30.00 per hour."<<endl;
cout<<"Package 2:400 hours of access are provided for P700.00. Exceeding hours costs P20.00 per hour."<<endl;
cout<<"Package 3:Unlimited acess is provided for P999.00."<<endl;
cout<<"\n\n ******What package do you want to avail? ";
cin>>packageNum;
if(packageNum==1)
{
cout<<"Package 1\n\n";
hours1();
}
else if(packageNum==2)
{
cout<<"Package 2\n\n";
hours2();
}
else if(packageNum=3)
{
cout<<"Package 3\n\n";
cout<<"The total amout you have to pay is P999.00. "<<endl;
system("pause");
}
}
getch();