CS 1044, Schuetz
Programming Assignment #3
Spring 1998
Due Date: 11:59 pm, Tuesday, March 3, 1998.
No Cooperative Work Allowed: Programming assignment 2 must be entirely your own work. Assistance should only be sought or accepted from the course GTA's, the course instructor, or the Computer Science paid consultants on duty in the evening in McBryde 116.
Objectives:
This assignment will give you the opportunity to 1) use nested loops, including a sentinel-controlled loop and a count-controlled loop, and 2) use nested if statements. Do not use functions or arrays.
Problem Statement:
You are the programmer for the Last Local Bank. You are to write a program that will produce a series of reports summarizing the transactions on a number of bank accounts. An account can go negative up to, and including the overdraft limit. If a check plus the $45 overdraft charge would cause the negative balance to exceed the overdraft limit, subtract only the overdraft charge and report that the transaction exceeds the overdraft limit.
If the average balance of an account is below $400, a 25 cent per check service charge should be calculated and subtracted from the closing balance. The average balance is computed by adding the beginning balance and the balance after each transaction, then dividing by the number of transactions + 1. If there is an overdraft, use the balance after deducting both the check and the $45 charge. In cases where the check is not honored because the overdraft limit would be exceeded, use the balance after subtracting the $45 fee.
Input:
The format of the input file is a sequence of groups of lines, with each group representing information about one account. This input data must be located in the file," asgn3.in". The first line of each group contains an account number (int), the beginning balance (double) for the account, the number of transactions (int) for that account, and the limit of overdraft credit (double) available to that account. Each remaining line in the group represents a single transaction for that account. Each transaction line contains first a dollar amount (double) and then a transaction code (C for Check or D for Deposit). Following the transaction lines for one account, there will be a whole set of similar data, starting with the account number, etc., for a different account. Your program should work correctly for any number of accounts and any number of transactions per account. The sentinel value of -999 will mark the end of the file. Assume all data items are valid.
Sample input data:
45918 627.42 4 300.00 (first account)
Output:
Your program should create and send output to a file named "asgn3.out". Your output should have the exact form illustrated below. Be very careful to provide for blank lines exactly where they are shown, and follow spelling and capitalization exactly. Do not worry about the exact number of asterisks or hyphens on the divider lines that are continuous across a majority of the width of the page. For these lines, you should approximate the line length shown relative to the other data printed. Failure to follow the remainder of the form exactly will result in the automated grader deducting points. An example follows for the sample input above.
Documentation: Your program should include all the documentation called for in the "Elements of Programming Style," including a header for the main program and readable in-line documentation that describes the function of each logical segment of code.
Turn in:
You should submit your source code electronically to the automated grader. As with the first programming project, you will be allowed a maximum of four submits. Your submissions are archived by the grader. On a random basis, certain of the assignments this semester will be hand graded for the entire class for conformance to departmental documentation and coding style standards. For our class section, this assignment should be submitted as Project Number 3.