Electricity Billing Management System in C
Electricity Billing Management System in C
Project Overview
The Electricity Billing Management System is a C-based software application designed to handle
the billing process for electricity consumption automatically. This system allows users to input
customer details, calculate bills based on electricity consumption, display and save bills, and
manage customer records efficiently.
Table of Contents
1. Introduction
2. System Requirements
3. System Design
4. Implementation
5. Testing and Validation
6. Conclusion
7. Future Enhancements
8. References
Chapter 1: Introduction
Objective
The objective of this project is to develop an automated billing management system that
calculates electricity bills based on the units consumed by customers. The system aims to:
Scope
The system handles the storage, retrieval, and modification of customer data.
It calculates bills using a tiered rate system based on the number of units consumed.
It provides functionalities to display, save, and read bills.
Technologies Used
Programming Language: C
IDE: Code::Blocks, Turbo C++, Dev C++, or any other C-compatible IDE
File Handling: For storing and retrieving customer records.
Software Requirements
1. Input Customer Details: Collects customer information like name, address, contact, and
units consumed.
2. Calculate Electricity Bill: Computes the bill based on units consumed using a tiered rate
system.
3. Display Bill: Outputs the generated bill with all customer details.
4. Save and Retrieve Records: Stores the customer data and bill in a file and allows
reading back the records.
A flowchart can be created showing the sequence from data input, bill calculation,
display, and save operations.
Algorithm
1. Start.
2. Display the main menu with options.
3. Depending on user input:
o Input customer details.
o Calculate the bill based on units consumed.
o Display the bill.
o Save bill details to a file.
o Read and display saved records.
4. Repeat until the user exits.
5. Stop.
Chapter 4: Implementation
Code Implementation
Below is the complete code for the Electricity Billing Management System:
c
Copy code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Function prototypes
void inputCustomerDetails(struct Customer *c);
void calculateBill(struct Customer *c);
void displayBill(struct Customer c);
void saveToFile(struct Customer c);
void readFromFile();
int main() {
int choice;
struct Customer c;
do {
printf("\n--- Electricity Billing Management System ---\n");
printf("1. Input Customer Details\n");
printf("2. Calculate Bill\n");
printf("3. Display Bill\n");
printf("4. Save Bill to File\n");
printf("5. Read All Records\n");
printf("6. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1:
inputCustomerDetails(&c);
break;
case 2:
calculateBill(&c);
break;
case 3:
displayBill(c);
break;
case 4:
saveToFile(c);
break;
case 5:
readFromFile();
break;
case 6:
printf("Exiting...\n");
break;
default:
printf("Invalid choice! Please try again.\n");
}
} while (choice != 6);
return 0;
}
Structure Customer: Defines a customer’s details including ID, name, address, contact
number, units consumed, and bill amount.
Function Descriptions:
o inputCustomerDetails(): Takes input from the user for customer details.
o calculateBill(): Calculates the electricity bill based on a tiered rate system.
o displayBill(): Displays the customer’s bill.
o saveToFile(): Saves the customer’s details and bill to a file for future reference.
o readFromFile(): Reads and displays all saved records from the file.
Sample Input/Output
Chapter 6: Conclusion
The Electricity Billing Management System project successfully automates the billing process,
providing a user-friendly interface for managing customer data and generating accurate bills. The
project demonstrates efficient use of C programming concepts such as structures, file handling,
and modular design.
Chapter 8: References
C Programming Textbooks (e.g., "Let Us C" by Yashavant Kanetkar
4o