- a header record (first record), which provides the total kilowatt hours used during the month by all customers
- a number of detail records, each containing the customer number, customer name and electricity usage (in kilowatt hours) for the month.
Design a solution algorithm that will read the electricity usage file and produce an electricity usage report showing the customer number, customer name, electricity usage and the amount owing. The amount owing is calculated at 11 cents for each kilowatt hour used, up to 200 hours, and 8 cents for each kilowatt hour used over 200 hours. The total electricity usage in kilowatt hours is also to be accumulated.
At the end of the program, compare the total electricity usage accumulated in the program with the value provided in the header record, and print an appropriate message if the totals are not equal.© BrainMass Inc. brainmass.com December 20, 2018, 4:46 am ad1c9bdddf
Please note that following pseduo-code is merely a guidance. You may want to refine it as per your taught pseudo-code format.
// customers is an array of details records.
fileHandle = openFile(ElectricityUsageFile)
givenUsage = readHeader(fileHandle) // Advances the file pointer to first details ...
Pseduo-code presented in solution should be taken as a mere guidance.