Purchase Solution

Pseudo-code to produce electricity usage report

Not what you're looking for?

Ask Custom Question

An electricity supply authority records on an electricity usage file the amount of electricity that each customer uses. This file consists of:

- 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.

Purchase this Solution

Solution Summary

Pseduo-code presented in solution should be taken as a mere guidance.

Solution Preview

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 ...

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Basic Networking Questions

This quiz consists of some basic networking questions.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.