Bcsl21 Practical
Bcsl21 Practical
The Electricity Bill Calculator is an application-based micro project that calculates the month’s electricity bill based
on the appliances or loads and units consumed. People who do not have a technical understanding of calculating power
bills can use this program to forecast/calculate their electricity bills. The application should have the following features:
To display the Meter Number
To display the previous meter reading
Facility to enter present meter-reading
To display the no. of units consumed
To display the complete Tariff Structure (Domestic, Non-Domestic, Industrial)
Provision to input the no. of units consumed per month
To display the bill-amount payable as per the tariff structure
To display the due date of the payment
Note: Assumptions can be made wherever necessary and list them. You must execute the program and submit the
program logic, sample input and output along with the necessary documentation for this question.
Answer:
#include <stdio.h>
int main()
{ int meterno = 123, conu, curr, past_reading = 1230;
float chg, surchg = 0, gramt, netamt;
printf("Meter no : %d\n", meterno);
printf("Past meter reading : %d \n", past_reading);
printf("Input the current meter reading : ");
scanf("%d", &curr);
conu = curr - past_reading;
printf("Unit consumed : %d", conu);
printf("\n\n***************Tariff charges******************\nType Charges\n");
printf("Domestic(Less than 200) @1.2/unit\n");
printf("(upto 400 more than 200) @1.5/unit\n");
printf("(upto 600 more than 400) @1.8/unit\n");
printf("(More than 600) @2.0/unit\n");
printf("Non-domestic @2.0/unit\n");
printf("Indrustrial @2.5/unit\n");
if (conu <200 ) chg = 1.20;
else if (conu>=200 && conu<400) chg = 1.50;
else if (conu>=400 && conu<600) chg = 1.80;
else chg = 2.00; gramt = conu*chg;
if (gramt>300){ surchg = gramt * 15 / 100.0;
netamt = gramt + surchg;}
if (netamt < 100)
netamt =100;
printf("\n**************Electricity Bill*************\n");
printf("Enter Consumed unit per month: ");
scanf("%d", &conu);
printf("Amount Charges @Rs. %4.2f per unit :%8.2f\n",chg,gramt);
printf("Surchage Amount :%8.2f\n",surchg);
printf("Net Amount Paid By the Customer :%8.2f\n",netamt);
printf("Due date for payment : 18-11-2022");}