Assignment #3 - 94B
Assignment #3 - 94B
Assignment 3
============
Due: 6 October 1994
Weight: 25
T. A.: V. Jain McConnell 322 Friday 10-12
Mail to: HCA3 << All other destination will be ignored
The purpose of this assignment is to exercise the input and output
of data using FORMAT statements, and the use of control structures
in a FORTRAN program.
Electricity Bill:
-----------------
Write a program that will input cards in the form
NAME 20 columns
ACCOUNT NUMBER 7 columns
CODE 2 columns
KILOWATT-HOURS 5 columns
ARREARS 7 columns
e.g.
Alfred Horowitz 2345 2 5678 20.0
Michael Brendel 11120 1 23 0.05
...
...
...
(Many lines of input)
Assume that...
* CODE is ignored by this calculation and isn't required to
be printed out in the output.
* Arrears are given to two decimal places.
* The last card has a blank in column 1.
The program will output a report for all customers, one customer per
line. Each line consists of the customer's name, account number, the
number of kilowatt-hours, the arrears, and the total bill. Use the
rate of 8 cents per KWH up to 100KWH, and 5 cents per KWH beyond
100KWH. You are free to choose any reasonable format for the output,
but be sure to line everything up in columns, and put a header at the
top to label each column.
A sample output could be like this:
-----------------------------------------------------------------------
Name Account No. Consumption Arrears($) Total Bill($)
-----------------------------------------------------------------------
Alfred Horowitz 2345 5678 20.00 306.90
Michael Brendel 11120 23 0.05 1.89
......
......
......
Create some data to test your program. Try to create as many different
situations as possible, such as KWH above and below 100, maximum-length
fields (20-letter names, 7-digit account numbers, etc.), negative
arrears (credits), etc. Send your code, with its data, and the output
of your program.