Project 3: |
Problem | Solution$> | Solution Using Formatted Output |
CSE 1503 Introduction to Computer Programming with FORTRAN
Section 1 & 2 Due Date: March 16, 1999
|
|
PROBLEM
Suppose we have an input file of the following form. There are unknown number of input lines. A positive number means a deposit. A negative number means payment. A zero (0) means a check balance. +123 +78 0 -50 +100 +10 -120 0 -50 +150 If the number is positive, this is a deposit line. In this case, you have to call a function called Deposit. In the latter function, you have to process all information related to deposit including the file output. The same apply to a payment and check balance where you have to create two other functions called Payment and CheckBalance, respectively. Write a Fortran program that reads in these input lines and writes the following table into a new output file: Check Book Reference Listing ============================ Count Payment Deposit Balance ----- ------- ------- ------- 1 ******* 123 123 2 ******* 78 201 ----------------------------------- 3 0 201 201 ----------------------------------- 4 50 ******* 151 5 ******* 100 251 6 ******* 10 261 7 120 ******* 141 ----------------------------------- 8 170 311 141 ----------------------------------- 9 50 ******* 91 10 ******* 150 241 ----------------------------------- Total 220 461 241 The above table has four columns:
If the input line is zero (0), then your program should print a dashed line, followed by the total payment and total deposit up to this point, and the current balance, followed by another dashed line. At the end of the report, a dashed line followed by the total payment, total deposit and current balance must be printed. NOTES
PROGRAM BankStatement !--------------------------------------------------------------------------- ! Name: (your name) ! Student ID # : (your id) ! ! (description of the program) ! Input Variables: (variables list) ! Output Variables: (variables list) !---------------------------------------------------------------------------IMPLICIT NONE (program statements) CONTAINS FUNCTION Deposit(possible_arguments) (function statements) END FUNCTION DEPOSITFUNCTION Payment(possible_arguments) (function statements) END FUNCTION PAYMENTFUNCTION CheckBalance(possible_arguments) (function statements) END FUNCTION CheckBalanceEND PROGRAM BankStatement
|