Write a Java program using if, if-else, and if-else-if statements to calculate the electricity bill based on the number of units consumed.
Edit ElectricityBillCalculator.java to:
- Accept user input for units consumed.
- Apply tiered rates based on the unit slabs.
- Output the total bill amount.
- A single integer representing total units consumed.
- The electricity bill in rupees with one decimal place.
- Up to 100 units: ₹1.5/unit
- 101–300 units: ₹2.5/unit for units above 100
- 301–500 units: ₹4/unit for units above 300
- Above 500 units: ₹6/unit for units above 500
Enter total units consumed: 80
Electricity Bill: 120.0 INR
Enter total units consumed: 450
Electricity Bill: 1250.0 INR
- You must not use functions or methods other than
main. - You must use
if,if-else, orif-else-if. - Do not use arrays, loops, or switch-case.