An electricity board charges according to following rates:
For the first 100 units-40paise per unit
For the next 200 units-50 paise per unit
Beyond 300 units-60 paise per unit.
All users are charged meter charge also which is Rs 50.
Write a program to read the name of users and number of units consumed, and print out the charges with names.
#include <iostream.h>
#include <conio.h>
void
main()
{
clrscr();
char name[25];
float
units,tc;
cout<<"Electricity Board Charges\n";
cout<<"\nPlease
enter user name : ";
cin>>name;
cout<<"\n\nPlease enter number
of units consumed:-";
cin>>units;
if(units<=100)
tc=units*0.40;
elseif(units<=300)
tc=units*0.50;
else
tc=units*0.60;
float total_cost = tc + 50;
cout<<"\nYour
bill amount:& "<<total_cost;
getch();
}
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!
Learn more about our help with Assignments:
C++