Problem 1 An electric supply company is charging the electri

Problem 1. An electric supply company is charging the electricity consumption, as follows:
A. For the first 200 units, 2.5 AED per unit
B. For the next 300 units, 4.5 AED per unit
C. Over 500 units, 5.5 AED per unit
In addition, to encourage low electricity consumption, the company offers 10% discount if the consumption is less than 180 units, and 5% surcharge is added to the cost if the consumption is greater than 600 units.
Write a C program that reads the electricity consumption in units and displays:
a) The consumer consumption cost
b) The amount of discount if any
c) The amount of surcharge if any

Solution

#include<iostream.h>
#include<conio.h>

void main()
{ int eunits;
float ccost;


pritnf(\"Please enter electricity consumption\");
scanf(\"%d\",&eunits);

if(eunits<=200)
{
if(eunits<180){

ccost = 2.5*200;
ccost = ccost-((10*2.5*200)/100);
printf(\"The consumption cost is %f\",&ccost);

}

else
{ccost = 2.5*200;
printf(\"The consumption cost is %f\",&ccost);

}
}
else if(eunits<=500)
{
ccost = 2.5*200;
ccost = ccost+(eunits-200);
printf(\"The consumption cost is %f\",&ccost);
}

else
{
if(eunits>600)
{
ccost = 5.5*eunits+((5*5.5*eunits)/100);
printf(\"The consumption cost is %f\",&ccost);

}
else
{ccost = 5.5*eunits;
printf(\"The consumption cost is %f\",&ccost);
}
}

}

Problem 1. An electric supply company is charging the electricity consumption, as follows: A. For the first 200 units, 2.5 AED per unit B. For the next 300 unit
Problem 1. An electric supply company is charging the electricity consumption, as follows: A. For the first 200 units, 2.5 AED per unit B. For the next 300 unit

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site