9 An electricity supply authority records on an electricity usage file the amount of electricity
that each customer uses. This file consists of:
a) a header record (first record), which provides the total kilowatt hours used
during the month by all customers
b) 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.
This is what I wroteCalculate_kilowatts_hours_usage
Set customer_name
Set customer_number
Set customer_usage
Set customer_amount
Read customer_account
DOWHILE account exist
Get hourly_kilowatts
Add hourly_kilowatts to overused_kilowatts
Prompt operator for total_ hours
ENDDO
Hourly_kilowatts=.11+.08
Output hourly_kilowatts
END
Programming with algorithms
Started by vhayes, Jan 25 2010 12:58 AM
1 reply to this topic
#1
Posted 25 January 2010 - 12:58 AM
|
|
|
#2
Posted 25 January 2010 - 04:31 AM
Are you needed to go more in depth to each part? Because really this program is a set of algorithms, making up one big one. What you have done is outlined all the smaller parts. Are you needed to go into more detail? Eg. the algorithm needed to work out the customer amount or the hourly killowatts.


Sign In
Create Account

Back to top









