Electricity Bill Calculator (Java)
A simple Java console application that calculates the total electricity bill based on energy consumption (kWh) and customer type (residential or commercial).
This project was created to practice Java fundamentals, including user input, loops, conditionals, and basic calculations.
Pricing System
Electricity cost is calculated using a tiered pricing model:
- 0 – 250 kWh → €0.10 per kWh
- 251 – 500 kWh → €0.12 per kWh
- 500+ kWh → €0.15 per kWh
Fixed Charges
- Residential → €5
- Commercial → €12
Features
- User input validation (only accepts valid numbers)
- Tier-based electricity pricing
- Supports two customer types:
- Residential
- Commercial
- Detailed price breakdown:
- Fixed cost
- Cost per tier
- Prevents invalid inputs (negative or zero values)