100% found this document useful (1 vote)
141 views

BCSL-021 (2022-23) Solved Assignment

The document is a solved assignment question for a C language programming course. It asks students to create an electricity bill calculator program that takes meter readings and calculates the bill amount based on the tariff structure. The program logic is provided that reads the meter number and past/current readings, calculates units consumed, displays the tariff structure, and calculates charges, surcharge, and total amount payable depending on the units consumed and tariff slab. Sample input and output is also given showing the program flow.

Uploaded by

JOJI U.R
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
141 views

BCSL-021 (2022-23) Solved Assignment

The document is a solved assignment question for a C language programming course. It asks students to create an electricity bill calculator program that takes meter readings and calculates the bill amount based on the tariff structure. The program logic is provided that reads the meter number and past/current readings, calculates units consumed, displays the tariff structure, and calculates charges, surcharge, and total amount payable depending on the units consumed and tariff slab. Sample input and output is also given showing the program flow.

Uploaded by

JOJI U.R
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

www.techiya.

in

www.techiya.in
BCA Solved Assignment 2022-23
Course Code : BCSL-021
Course Title : C Language Programming
Assignment Number : BCA(2)/L-021/Assignment/2022-23

Q1. 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.

Ans. Program

#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);
1
www.techiya.in

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");
}

2
www.techiya.in

Output

3
www.techiya.in

4
www.techiya.in

You might also like