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.
1
Expert's answer
2012-12-06T11:48:40-0500
#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");

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
18.09.15, 16:48

Dear visitor,  please use panel for submitting new questions

siiib
09.09.15, 17:36

how about for vb6? badly need it. thanks!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS