An electricity company offers 3 different plans for its customers:
Plan A: For $75 per month, a usage of 500 killowatts (kW) is included. For each additional killowatt the customer pays $1 extra.
Plan B:For $100 per month, a usage of 700 killowatts (kW) is included. For each additional killowatt the customer pays $0.50 extra.
Plan C:For $125 per month, a usage of 900 killowatts (kW) is included. For each additional killowatt the customer pays $0.30 extra.
Write a program that calculates a customer’s monthly bill. The program should ask the user:
a) to enter the letter of the plan (A, B, or C) that the customer has enrolled in
b) the number of killowatts that were used by the customer this month
The program should then display the total monthly bill for the customer.
Requirements
- Use comments when appropriate.
- Give your variables meaningful and descriptive names. Naming a variable as “x”, or “y” is a bad example of variable naming.
- Use prompts to ask the user what they have to do. Be clear. Your program should be user-friendly. (Hint: Ask a family member or friend to run your program and then ask them if your prompts make sense and/or are clear).
- Use if/else or switch statements.
- Display the total charges using the appropriate formatting to show 2 decimal places. Include the dollar sign using the appropriate formatting.
- Input validation: If the user inputs a different letter other than A, B, or C, display an error message and terminate the program (do NOT use a loop as this topic is covered in Chapter 4).
- Save the file as FirstName_LastName_Project1 (e.g. Dimitrios_Sellountos_Project1).
0 comments