64 542
Assignments Done
99,3%
Successfully Done
In September 2018

Answer to Question #4402 in C++ for sanyam saxena

Question #4402
create a program to read the name of user and number of unit consumed and print out the charges with name.An electricity board charge the following rates of domestic user to encourage less consumption of electricity.
First 100 units 0.40 per unit
Next 100 units 0.60 Rs per unit
Next 100 units 0.70 Rs per unit
rest units 0.80 Rs per unit
all user are charged a minimum of 50/- if the total cost (excluding the minimum charge) is more than Rs.250 than an additional charge of 15% of the total charge is added .
Expert's answer
#include <cstdlib>
#include <iostream>

using namespace
std;
int i;
double total;
string a;
int main(int argc, char
*argv[])
{
do
{
cout<<"Enter your name :
";
cin>>a;
cout<<"Please enter units
numbers : ";
cin>>i;
if (i<50) cout<<"min
50!!"<<endl;
}
while (i<50);
if (i<=100)
total=(double)i*0.4;
if (i>100)
total=100*0.4+((double)i-100)*0.6;
if (i>100)
total=100*0.4+((double)i-100)*0.6;
if (i>=200)
total=100*0.4+100*0.6+((double)i-200)*0.7;
if (i>=300)
total=100*0.4+100*0.6+100*0.7+((double)i-300)*0.8;
if (total>=250)
total=total*1.15;
cout<<"Custumer : "<<a<<endl;

cout<<"Total sum is : "<<total<<endl;

system("PAUSE");
return EXIT_SUCCESS;
}

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

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions