#include <iostream>
using namespace std;
double ElectricityBillWithoutSurtax(double kilowattHoursConsumed) {
return (kilowattHoursConsumed <= 250.0) ? kilowattHoursConsumed * 0.11 : 250.0 * 0.11 + (kilowattHoursConsumed - 250.0) * 0.17;
}
double ElectricityBillWithSurtax(double kilowattHoursConsumed) {
return ElectricityBillWithoutSurtax(kilowattHoursConsumed)*1.1;
}
int main()
{
double kh;
cout << "Enter the number of kilowatt hours of electricity that the client has spent.\n";
cin >> kh;
cout << "The amount due without the surtax : $" << ElectricityBillWithoutSurtax(kh) << endl;
cout << "The total due with surtax : $" << ElectricityBillWithSurtax(kh) << endl;
}
Comments
Leave a comment