Example 18: Calculate Utility Bill
Explore how to implement decision-making in C by calculating utility bills based on customer categories and usage. This lesson teaches you to use switch cases and conditional statements to handle various billing scenarios, enhancing your skills in control flow and program logic.
We'll cover the following...
We'll cover the following...
Problem
An electricity utility company charges its customers on the following basis depending on the category they belong to and the units they have consumed for the month:
| Category | Fixed Cost | Units Consumed / Load | Price |
|---|---|---|---|
| Residential | $50/month for 1-phase meter $200/month for 3-phase meter |
0 to 100 units |