Y.
B Patil Polytechnic, Akurdi, Pune
                     ACADEMIC YEAR:-2024-2025
                       MICRO PROJECT REPORT
                      Energy Billing System(AJP)
Program: CO5I                             Course and Code: AJP (22516)
Topic: Energy Billing System
SUBMITTED BY:
      Sr. No.            Roll no.              Name of the Students
       1.                Y-A3331                   Sarthak Bhapkar
       2.                Y-A3332                   Diksha Kamble
       3.                Y-A3333                   Vinit Hivarkar
       4.                Y-A3334                   Pranav Swami
  MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
                            CERTIFICATE
This is to certify that the Project report entitled “Energy Billing System” was
successfully completed by students of Fifth semester Diploma in Computer
Engineering under the course Advance Java.
 Sr. No.         Roll no.     Name of the Students              Enrollment No.
     1.        Y-A3331            Sarthak Bhapkar               2201340102
     2.        Y-A3332             Diksha Kamble                2201340103
     3.        Y-A3333             Vinit Hivarkar               2201340104
     4.        Y-A3334             Pranav Swami                 2201340105
in partial fulfillment of the requirements for the award of Diploma in
Computer Engineering of institute Y.B.Patil Polytechnic, Akurdi work
carried out during the academic year 2024-2025 as per curriculum.
Mrs.Archana Bansod             Mrs.P.S.Ahuja                Dr.A.S.Kondekar
(Project Guide)                 (H.O.D)                         (Principal)
                        Micro- Project Proposal
1.0 Aims/Benefits of the micro project:
    Automate energy billing for accuracy and efficiency.
    Provide real-time energy usage insights.
    Minimize errors and operational costs.
    Enable secure, streamlined
2.0 Course Outcomes Addressed:
    Automation of billing systems.
    Analysis of energy usage data.
    Problem-solving in billing accuracy.
    Application of software and database skills.
    Integration of IoT for real-time monitoring
    Promotion of sustainability practices
3.0Proposed Methodology:
      Analyze system requirements.
      Design system architecture and interface.
      Collect energy consumption data.
      Develop billing algorithms.
      Integrate a database for storage.
      Build and test the software.
      Deploy and monitor the system.
4.0Action Plan:
 Sr.No       Details of activity       Planned      Planned   Name of
   .                                 start date    finish date     responsible
                                                                       team
                                                                    members
   1      Collected the required      8/10/24        9/10/24          Diksha
          materials                                               Kamble, Vinit
                                                                     Hivarkar
   2      Planned the outline of      10/10/24      11/10/24      Pranav Swami,
          the project                                                 Sarthak
                                                                     Bhapkar
   3      Working on micro           11/10//24      14/10 /24     Diksha Kamble
          project                                                      ,Vinit
                                                                     Hivarkar,
                                                                  Pranav Swami
                                                                      Sarthak
                                                                     Bhapkar
5.0 Resources Required:
 Sr.No.    Name of resource /      Specification     Quantity         Remarks
              material
   1.          Pc / Laptop           8 GB Ram            1
   2.       Operating System       Windows 10            1
                                        (To be approved by the concerned teacher)
                                                    Mrs.Archana Bansod
                      Evaluation Sheet for the Micro Project
Academic Year: 2024-2025                      Name of Faculty: Mrs.ArchanaBansod
Course: Advance Java                           Course Code: 22517     Semester: CO5I
Title of the Project: Energy Billing System
COs addressed by the Micro Project:
a) Front-End Development Skills: Develop a structured and styled user interface.
b) Problem-Solving Abilities: Implement logical flows and user feedback
Major Learning Outcomes achieved by students by doing the Project:
      Understanding automation in energy systems.
      Development of billing algorithms.
      Application of database management.
      Integration of IoT and real-time data processing.
 Roll No.      Student Name            Marks out of 6 for       Marks out of 4 for     Total out
                                      performance in group     performance in oral        of 10
                                            activity              / presentation
 Y-A3332       Sarthak Bhapkar
 Y-A3332       Diksha Kamble
 Y-A3333        VinitHivarkar
 Y-A3334        Pranav Swami
                                                             (Name & Signature of faculty)
                                                                     Mrs. Archana Bansod
                  INDEX
SR.NO   TOPIC
 1.         Introduction
 2.         Objective
 3.         Description Of Project
 4.         Technologies & Tools Used
 5.         Advantages & Disadvantages
 6.         Program Codes
 7.         Output
 8.         Conclusion And Refrence
            INTRODUCTION
Energy consumption and billing are critical components of modern utility
management. Traditional billing methods often involve manual readings and
calculations, which can lead to inaccuracies and inefficiencies. The Energy
Billing System aims to address these challenges by automating the entire
process, from data collection to bill generation . This project leverages
technology such as smart meters, databases, and algorithms to ensure accurate,
transparent, and real-time billing. Additionally, it empowers users to monitor
their energy usage and adopt sustainable practices, thereby contributing to
environmental conservation.
                               OBJECTIVES
Automate Meter Reading and Billing:
Develop a system to record energy consumption and generate accurate bills
automatically.
Improve Billing Efficiency:
Eliminate manual errors and delays in bill generation.
Enhance Data Management:
Store and retrieve energy usage and billing information securely in a centralized
database.
Provide Real-Time Insights:
Allow users to monitor their energy usage and billing history for better
consumption management
Promote Sustainable Practices:
Encourage users to optimize their energy consumption through detailed insights.
DESCRIPTION OF PROJECT
   1. Overview
The Energy Billing System is a software solution that integrates data collection, bill
calculation, and payment management in a single platform. It uses databases to manage user
profiles, meter readings, and billing records, ensuring accuracy and efficiency.
   2. Modules and Features
a. User Registration and Login:
Users can register their accounts and log in securely.
Unique User IDs are assigned for tracking energy usage.
b. Meter Reading Input:
Allows the input of energy consumption details, such as units used and reading dates.
Data is stored in the “MeterReadings” table in the database for further processing.
c. Bill Calculation:
Bills are calculated based on predefined tariffs using the recorded energy consumption.
The “BillingDetails” table stores calculated amounts and billing dates.
d. Database Management:
A SQLite database is used to store and manage user information, meter readings, billing
details, and payment records.
e. User Interface:
A simple and intuitive dashboard includes tabs for Login, Registration, Meter Reading, and
Bill Calculation.
   3. Workflow
Input Meter Readings:
Users enter their energy consumption details (e.g., units used and reading date).
Bill Calculation:
The system calculates the bill based on a predefined rate (e.g., ₹5.50 per unit).
Database Storage:
Details of readings and bills are securely stored in the database.
   4. Database Structure
The database includes the following tables:
Users: Stores user details such as User ID and credentials.
Name: Name of the user
Email : User Email
Password: Password of Email
MeterReadings: Records energy consumption data (e.g., units used, reading date).
BillingDetails: Maintains billing data, including amounts and billing dates.
Amount :
Billing Date:
               TECHNOLOGIES AND TOOLS USED
Hardware:
Computer PC, Windows
Software:
Programming languages (Java), database systems (e.g., MySQL), and front-end
technologies (e.g., HTML, CSS, JavaScript).
ADVANTAGES :
   1. Reduces manual errors in billing.
   2. Provides real-time insights into energy usage.
   3. Simplifies the payment process.
   4. Enhances transparency and user satisfaction.
   5. Encourages energy conservation through data-driven insights
                            PROGRAM CODE
package MyPackage;
Import javax.swing.*;
Import java.awt.*;
Import java.sql.*;
Public class Dashboard {
  Public static void main(String[] args) {
     JFrame frame = new JFrame(“Energy Billing System Dashboard”);
     JTabbedPane tabbedPane = new JTabbedPane();
      // Login Tab
      JPanel loginTab = createLoginTab(tabbedPane);
      tabbedPane.add(“Login”, loginTab);
      // Registration Tab
      JPanel registrationTab = createRegistrationTab(tabbedPane);
      tabbedPane.add(“Register”, registrationTab);
      // Meter Reading Tab
      JPanel meterReadingTab = createMeterReadingTab();
      tabbedPane.add(“Meter Reading”, meterReadingTab);
      // Bill Calculation Tab
      JPanel billCalculationTab = createBillCalculationTab();
      tabbedPane.add(“Bill Calculation”, billCalculationTab);
      frame.add(tabbedPane, BorderLayout.CENTER);
      frame.setSize(600, 400);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);
  }
  // Create the Login Tab
  Private static JPanel createLoginTab(JTabbedPane tabbedPane) {
     JPanel panel = new JPanel(null);
     JLabel emailLabel = new JLabel(“Email:”);
     JLabel passwordLabel = new JLabel(“Password:”);
     JTextField emailField = new JTextField();
      JPasswordField passwordField = new JPasswordField();
      JButton loginButton = new JButton(“Login”);
      JButton goToRegisterButton = new JButton(“New User? Click here”);
      emailLabel.setBounds(50, 50, 100, 30);
      emailField.setBounds(150, 50, 200, 30);
      passwordLabel.setBounds(50, 100, 100, 30);
      passwordField.setBounds(150, 100, 200, 30);
      loginButton.setBounds(150, 150, 100, 30);
      goToRegisterButton.setBounds(150, 200, 200, 30);
    loginButton.addActionListener(e -> {
      try (Connection con =
DriverManager.getConnection(“jdbc:sqlite:EnergyBillingSystem.db”)) {
         String query = “SELECT * FROM Users WHERE Email = ? AND
Password = ?”;
         PreparedStatement pst = con.prepareStatement(query);
         Pst.setString(1, emailField.getText());
         Pst.setString(2, new String(passwordField.getPassword()));
            ResultSet rs = pst.executeQuery();
            If (rs.next()) {
               JOptionPane.showMessageDialog(panel, “Login Successful!”);
            } else {
               JOptionPane.showMessageDialog(panel, “Invalid Credentials!”);
            }
         } catch (Exception ex) {
            Ex.printStackTrace();
         }
      });
     goToRegisterButton.addActionListener(e ->
tabbedPane.setSelectedIndex(1));
      panel.add(emailLabel);
      panel.add(emailField);
      panel.add(passwordLabel);
      panel.add(passwordField);
      panel.add(loginButton);
      panel.add(goToRegisterButton);
      return panel;
  }
  // Create the Registration Tab
  Private static JPanel createRegistrationTab(JTabbedPane tabbedPane) {
     JPanel panel = new JPanel(null);
     JLabel nameLabel = new JLabel(“Name:”);
     JLabel emailLabel = new JLabel(“Email:”);
     JLabel passwordLabel = new JLabel(“Password:”);
     JTextField nameField = new JTextField();
     JTextField emailField = new JTextField();
     JPasswordField passwordField = new JPasswordField();
     JButton registerButton = new JButton(“Register”);
    nameLabel.setBounds(50, 50, 100, 30);
    nameField.setBounds(150, 50, 200, 30);
    emailLabel.setBounds(50, 100, 100, 30);
    emailField.setBounds(150, 100, 200, 30);
    passwordLabel.setBounds(50, 150, 100, 30);
    passwordField.setBounds(150, 150, 200, 30);
    registerButton.setBounds(150, 200, 100, 30);
    registerButton.addActionListener(e -> {
      try (Connection con =
DriverManager.getConnection(“jdbc:sqlite:EnergyBillingSystem.db”)) {
         String query = “INSERT INTO Users (Name, Email, Password)
VALUES (?, ?, ?)”;
         PreparedStatement pst = con.prepareStatement(query);
         Pst.setString(1, nameField.getText());
         Pst.setString(2, emailField.getText());
         Pst.setString(3, new String(passwordField.getPassword()));
         Pst.executeUpdate();
          JOptionPane.showMessageDialog(panel, “Registration Successful!”);
          tabbedPane.setSelectedIndex(0); // Redirect to Login Tab
       } catch (Exception ex) {
          Ex.printStackTrace();
       }
    });
    Panel.add(nameLabel);
    Panel.add(nameField);
    Panel.add(emailLabel);
    Panel.add(emailField);
    Panel.add(passwordLabel);
    Panel.add(passwordField);
      Panel.add(registerButton);
      Return panel;
  }
  // Create the Meter Reading Tab
  Private static JPanel createMeterReadingTab() {
     JPanel panel = new JPanel(null);
     JLabel userIdLabel = new JLabel(“User ID:”);
     JLabel readingDateLabel = new JLabel(“Reading Date:”);
     JLabel unitsUsedLabel = new JLabel(“Units Used:”);
     JTextField userIdField = new JTextField();
     JTextField readingDateField = new JTextField();
     JTextField unitsUsedField = new JTextField();
     JButton submitButton = new JButton(“Submit”);
      userIdLabel.setBounds(50, 50, 100, 30);
      userIdField.setBounds(150, 50, 200, 30);
      readingDateLabel.setBounds(50, 100, 100, 30);
      readingDateField.setBounds(150, 100, 200, 30);
      unitsUsedLabel.setBounds(50, 150, 100, 30);
      unitsUsedField.setBounds(150, 150, 200, 30);
      submitButton.setBounds(150, 200, 100, 30);
    submitButton.addActionListener(e -> {
      try (Connection con =
DriverManager.getConnection(“jdbc:sqlite:EnergyBillingSystem.db”)) {
         String query = “INSERT INTO MeterReadings (UserID,
ReadingDate, UnitsUsed) VALUES (?, ?, ?)”;
         PreparedStatement pst = con.prepareStatement(query);
         Pst.setInt(1, Integer.parseInt(userIdField.getText()));
         Pst.setString(2, readingDateField.getText());
         Pst.setInt(3, Integer.parseInt(unitsUsedField.getText()));
         Pst.executeUpdate();
          JOptionPane.showMessageDialog(panel, “Reading Submitted
Successfully!”);
       } catch (Exception ex) {
          Ex.printStackTrace();
       }
    });
      Panel.add(userIdLabel);
      Panel.add(userIdField);
      Panel.add(readingDateLabel);
      Panel.add(readingDateField);
      Panel.add(unitsUsedLabel);
      Panel.add(unitsUsedField);
      Panel.add(submitButton);
      Return panel;
  }
  // Create the Bill Calculation Tab
  Private static JPanel createBillCalculationTab() {
     JPanel panel = new JPanel(null);
     JLabel userIdLabel = new JLabel(“User ID:”);
     JLabel billDateLabel = new JLabel(“Billing Date:”);
     JLabel amountLabel = new JLabel(“Amount:”);
     JTextField userIdField = new JTextField();
     JTextField billDateField = new JTextField();
     JTextField amountField = new JTextField();
     JButton calculateButton = new JButton(“Calculate”);
     JButton submitButton = new JButton(“Submit”);
      userIdLabel.setBounds(50, 50, 100, 30);
      userIdField.setBounds(150, 50, 200, 30);
      billDateLabel.setBounds(50, 100, 100, 30);
      billDateField.setBounds(150, 100, 200, 30);
      amountLabel.setBounds(50, 150, 100, 30);
      amountField.setBounds(150, 150, 200, 30);
      calculateButton.setBounds(50, 200, 100, 30);
      submitButton.setBounds(200, 200, 100, 30);
    calculateButton.addActionListener(e -> {
      try (Connection con =
DriverManager.getConnection(“jdbc:sqlite:EnergyBillingSystem.db”)) {
         String query = “SELECT SUM(UnitsUsed) AS TotalUnits FROM
MeterReadings WHERE UserID = ?”;
         PreparedStatement pst = con.prepareStatement(query);
         Pst.setInt(1, Integer.parseInt(userIdField.getText()));
          ResultSet rs = pst.executeQuery();
          If (rs.next()) {
             Int totalUnits = rs.getInt(“TotalUnits”);
             Double amount = calculateBillAmount(totalUnits);
             amountField.setText(String.valueOf(amount));
          } else {
              JOptionPane.showMessageDialog(panel, “No meter readings found
for the user.”);
            }
         } catch (Exception ex) {
            Ex.printStackTrace();
         }
      });
     submitButton.addActionListener(e -> {
       try (Connection con =
DriverManager.getConnection(“jdbc:sqlite:EnergyBillingSystem.db”)) {
          String query = “INSERT INTO BillingDetails (UserID, Amount,
BillingDate) VALUES (?, ?, ?)”;
          PreparedStatement pst = con.prepareStatement(query);
          Pst.setInt(1, Integer.parseInt(userIdField.getText()));
          Pst.setDouble(2, Double.parseDouble(amountField.getText()));
          Pst.setString(3, billDateField.getText());
          Pst.executeUpdate();
          JOptionPane.showMessageDialog(panel, “Bill Details Submitted
Successfully!”);
       } catch (Exception ex) {
          Ex.printStackTrace();
       }
    });
        Panel.add(userIdLabel);
        Panel.add(userIdField);
        Panel.add(billDateLabel);
        Panel.add(billDateField);
        Panel.add(amountLabel);
        Panel.add(amountField);
        Panel.add(calculateButton);
        Panel.add(submitButton);
        Return panel;
    }
    Private static double calculateBillAmount(int totalUnits) {
      Double rate = 5.5; // Example rate per unit
      Return totalUnits * rate;
    }
}
                                  Database
 package MyPackage;
Import java.sql.Connection;
Import java.sql.DriverManager;
Import java.sql.Statement;
Public class EnergyBillingSystemDBSetup {
  Public static void main(String[] args) {
     // Step 1: Establish the SQLite connection
     Try (Connection con =
DriverManager.getConnection(“jdbc:sqlite:EnergyBillingSystem.db”)) {
        System.out.println(“Database connected and/or created successfully.”);
       // Step 2: Create the required tables
       Statement stmt = con.createStatement();
       // Users table
       String createUsersTable = “CREATE TABLE IF NOT EXISTS Users (“
            + “UserID INTEGER PRIMARY KEY AUTOINCREMENT, “
            + “Name TEXT NOT NULL, “
            + “Email TEXT UNIQUE NOT NULL, “
            + “Password TEXT NOT NULL)”;
       Stmt.execute(createUsersTable);
     // MeterReadings table
     String createMeterReadingsTable = “CREATE TABLE IF NOT
EXISTS MeterReadings (“
          + “ReadingID INTEGER PRIMARY KEY AUTOINCREMENT, “
          + “UserID INTEGER, “
          + “ReadingDate TEXT, “
          + “UnitsUsed INTEGER, “
          + “FOREIGN KEY(UserID) REFERENCES Users(UserID))”;
     Stmt.execute(createMeterReadingsTable);
       // BillingDetails table
       String createBillingDetailsTable = “CREATE TABLE IF NOT EXISTS
BillingDetails (“
             + “BillID INTEGER PRIMARY KEY AUTOINCREMENT, “
             + “UserID INTEGER, “
             + “Amount REAL, “
             + “BillingDate TEXT, “
              + “FOREIGN KEY(UserID) REFERENCES Users(UserID))”;
          Stmt.execute(createBillingDetailsTable);
      // Payments table
      String createPaymentsTable = “CREATE TABLE IF NOT EXISTS
Payments (“
            + “PaymentID INTEGER PRIMARY KEY AUTOINCREMENT,
“
            + “UserID INTEGER, “
            + “AmountPaid REAL, “
            + “PaymentDate TEXT, “
            + “FOREIGN KEY(UserID) REFERENCES Users(UserID))”;
      Stmt.execute(createPaymentsTable);
           System.out.println(“Tables created successfully!”);
        } catch (Exception e) {
           e.printStackTrace();
        }
    }
}
Output
DATABASE
                                   Conclusion
The Energy Billing System is an innovative solution that automates and
simplifies the energy billing process. By integrating data collection, billing
calculations, and payment management into a unified platform, the system
significantly reduces manual errors and enhances efficiency. Its user-friendly
interface and secure database management ensure reliability and convenience
for both users and administrators. Additionally, the project encourages energy
conservation by providing users with detailed insights into their consumption
patterns, fostering sustainable practices.
This project not only demonstrates the application of database management,
programming, and automation techniques but also highlights the potential of
technology in solving real-world problems effectively. It serves as a scalable
and adaptable solution for energy providers and sets a strong foundation for
future enhancements, such as IoT integration and advanced analytics.