Coders Packet

Calculate electricity bill using Java


We are going to build java program that calculate electrity bill based on the given units.

In this program person is asked to give the units through which we calculate electricitry based on it's units.

For diffrent range of unit there is diffrent unit per rupee cost that is as follows:

  1. If unit consumed <= 100 then cost per unit is Rs 1.50
  2. If unit consumed > 100 and <300 then cost per unit is Rs 2.5
  3. If unit consumed >301 and then cost per unit is Rs 3.0

Read the commets for more detail as it mentein in the code.


source code

NOTE : As in the code if a person units is 450 then for the first 100 units cost will be 1.5 then for next units till 300 units cost willl be 2.5 then the remaining units which is 3.0 rupee per unit. at last all the cost will be sumed and bill will be displayed.

Download Complete Code


No comments yet