java program to input number of unit electricity consumed and calculate electricity bill

Programming Example

An electricity company charges their consumers according to the units consumed per month according to the given traffic:

Units Consumed
Up to 100 units
₹ 2 per unit
More than 100 units and up to 200 units
₹ 1.80 per unit
More than 200 units
₹ 1.50 per unit

In addition to the above, every consumer has to pay ₹ 200 as Service Charge per month. Write a program to input the amount of units consumed and calculate the total charges payable (Bill) by the consumer.


import java.util.*;
class Bill
    public static void main(String arr[])
        float u,c;
        Scanner sc=new Scanner(;
        System.out.println("Enter the units consumed:");
        if (u<=100)
        else if (u<=200)
        System.out.println("Amount Payable="+c);

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad