Skip to content

Pacepetson/ElectricityBillCalculator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

💡 Electricity Bill Calculator

👨‍🏫 Objective

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.

💻 Task

Edit ElectricityBillCalculator.java to:

  1. Accept user input for units consumed.
  2. Apply tiered rates based on the unit slabs.
  3. Output the total bill amount.

⚙️ Input

  • A single integer representing total units consumed.

📤 Output

  • The electricity bill in rupees with one decimal place.

💡 Billing Rates

  • 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

🧪 Sample I/O

Example 1

Enter total units consumed: 80  
Electricity Bill: 120.0 INR

Example 2

Enter total units consumed: 450  
Electricity Bill: 1250.0 INR

🚫 Restrictions

  • You must not use functions or methods other than main.
  • You must use if, if-else, or if-else-if.
  • Do not use arrays, loops, or switch-case.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 100.0%