-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelectricbill.cpp
More file actions
47 lines (47 loc) · 819 Bytes
/
electricbill.cpp
File metadata and controls
47 lines (47 loc) · 819 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
#include <iostream>
using namespace std;
int main2()
{
float bill=0, units, remain, surcharge;
cout << "Please enter your electricity units here: ";
cin >> units;
if (units >0)
{
bill = bill + 50 * 0.5;
units = units - 50;
if (units >= 150)
{
bill = bill + 0.75 * 100;
units -= 100;
if (units >= 250)
{
bill = bill + 1.20 * 100;
units -= 100;
if (units > 250)
{
bill = bill + 1.50 * units;
}
else
{
bill = bill + 1.20 * units;
}
}
else
{
bill = bill + 0.75 * units;
}
}
else
{
bill = bill + 0.50 * units;
}
}
else
{
cout << "You haven't used any electicity, are you in a stone age bruv " << endl;
}
surcharge = bill * 20 / 100;
bill = bill + surcharge;
cout << "Your total bill is " << bill << endl;
return 0;
}