Question an electric company charges customers based on


Question: An electric company charges customers based on Kilowatt-Hours (Kwh) used. The rules to compute the charge are:

First 100 Kwh, 20 cents per Kwh
Each of the next 100 Kwh (up to 200 Kwh), 30 cents per Kwh
(the first 100 Kwh used is still charged at 20 cents each)
Each of the next 200 Kwh (up to 400 Kwh) 45 cents per Kwh
All KHwh over 400, 60 cents per KH

Create a C# Form with a textbox to enter Kwh used, a read-only textbox to display the electricity charges, and a button to compute the charges. The Kwh used could be a number with decimals.

Requirements:

1. Input validation: Use the KWH textbox validating event to enforce two validation rules:

a. The Kwh contains digits only. The validating procedure should use a Try/Catch block to throw an error message "Please enter digits only!" if the entered Kwh is not a valid number or blank.

b. The Kwh cannot exceed 2000. Test your program with (1) , (2) Kwh = 250

1250_program based on Kilowatt-Hours.jpg

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Question an electric company charges customers based on
Reference No:- TGS01130052

Now Priced at $15 (50% Discount)

Recommended (90%)

Rated (4.3/5)