Coders Packet

Java program to calculate Electricity Bill

By Sonali Mahadev Sankpal

Is you curious about how the electricity bill is calculates? In this Java program we are going to calculate electricity bill using real charges applied on unit consumption.

Steps:

1.Import java.util.*;

2.Add class with public static void main method

3. Declare all variables with their respective datatypes 

4. Declare object of Scanner

            Scanner sc= new Scanner(System.in);

5.Take input from user in following way:

            a.Customer Name (String)

            b.Customer Id (Int)

            c.Month in the from MMM-YYYY(String)

            d.Previous month meter reading(Int)

            e.Current month meter reading(Int)

Declaration of variables  and user input

6.Calculate unit consumed using previous month meter reading and currrent month meter reading 

                     unitConsumed = currentReading - previousReading 

7.Calculate Energy charges using following information

       Unit Consumed          0-100     101-300     301-500     501-1000     >1000

       Rate (per unit)           3.44       7.34           10.36         11.82           11.82

8.Fixed charges are also added for each month as per electricity board.

    Note: charges may vary state to state or after certain time period

9.Wheeling charges are applied 1.38 Rs per unit consumed 

         wheelingCharges = 1.38 * unitConsumed;   

10.Electricity duty charges are applied 16% on sum of energy charges , charges and wheeling charges

11.Calculate the total bill by taking sum of all charges 

         Calculation

12.Printing all values

printing all values

 

Output:

output

 

 

Download project

Reviews Report

Submitted by Sonali Mahadev Sankpal (SonaliSankpal)

Download packets of source code on Coders Packet