# Answer to Question #20189 in C++ for achmed

Question #20189

in order to discourage excess consumption, an electric company charges its customers a lower rate, namely $0.11, for each of the first 250 kilowatt hours and a higher rate of $0.17 for each additional kilowatt hour. in addition, a 10% surtax is added to the final bill. write a program to calculate electric bills given the number of kilowatt hours consumed to input.use two function declarations: one to compute the amount due without the surtax and one to compute the total due. the declaration of the second function should include a call to the first function.

Expert's answer

#include <iostream>

using namespace std;

float f1(float a){

float s;

if (a<250)

s=a*0.11;

else

s=250*0.11+(a-250)*0.17;

return s;

& }

float f2(float a){

& return f1(a)*1.1;

& }

int main(void)

{

float a;

cout<<"enter the number of kilowatt hours consumed : ";

cin>>a;

cout<<"total amount: "<<f2(a)<<endl;

system ("PAUSE");

}

using namespace std;

float f1(float a){

float s;

if (a<250)

s=a*0.11;

else

s=250*0.11+(a-250)*0.17;

return s;

& }

float f2(float a){

& return f1(a)*1.1;

& }

int main(void)

{

float a;

cout<<"enter the number of kilowatt hours consumed : ";

cin>>a;

cout<<"total amount: "<<f2(a)<<endl;

system ("PAUSE");

}

## Comments

Assignment Expert18.09.15, 16:48Dear visitor,

please use panel for submitting new questions

siiib09.09.15, 17:36how about for vb6? badly need it. thanks!

## Leave a comment