Starting from:

$20

Import Export Solution

Assignment Specifications

In this assignment, you develop a program to produce an import/export report. Details are given in the specs below.

This program is to be written so that input is from a file (batch), and the output in the text is printed to a disk file. The program must be written using void functions and the appropriate type of loop structure. You will not receive full credit if you do not use void functions. Do not write the program using selection structures (e.g., if/else), as we have not covered these yet, and they are not needed for this program.

You will need to create a data file (for input) on disk (as you did in the previous assignment). Use the sample data found in the specs for this file.


Specifications

You are writing this program for the owner of a small business that deals with importing and exporting goods. He wants to utilize the computer for the keeping of records, plus doing a bit of analysis. He would like to figure out the net balance of money after purchasing goods (importing) and selling goods (exporting). Someone has been entering each of the transactions into a textfile. You will write a C program to read this file and produce a report. This program should read a transaction type of either "IMPORT" OR "EXPORT" and some amount of money (dollars and cents) that belongs to that import or export. Your program should keep track of the total. All import numbers are negative and all export numbers are positive, so there’s no need to distinguish between them.

Here is some sample input (the string begins in column one of the textfile). It is unknown how many lines of input there are. All lines are structured similar to these:

IMPORT -25.19
EXPORT 35.41
EXPORT 100.25
IMPORT -500.34
EXPORT 240.35
IMPORT -134.56
EXPORT 459.56

(Note: The data file starts with a line of data, not with a blank line. The amount always starts on or after column 7.)

Here is some sample output, based on the sample input above. The first line of output is the line with “The MoneyMaking Corporation”; do not output a blank line before it.

The MoneyMaking Corporation
550 Warm Sands Drive
Palm Springs, CA 92262

Type Amount Net
---- ------ ---
IMPORT 25.19 -25.19
EXPORT 35.41 10.22
EXPORT 100.25 110.47
IMPORT 500.34 -389.87
EXPORT 240.35 -149.52
IMPORT 134.56 -284.08
EXPORT 459.56 175.48

The net total for the month is $175.48
Transactions processed: 7

(Note: In the actual output, the first line into the output file is the "The MoneyMaking Corporation" line; there is no blank line in the output file before it..

You may assume that the only two transaction types are “IMPORT” and “EXPORT”, both of which have a logical length of 6 (remember, therefore what length your variable should be!) But make sure your program can also handle transaction types that are less than that length (such as the word FEE, or TAX, or CHARGE). You might want to include an extra line with one of these transactions in your data file for testing purposes (please submit only the output from the data above though). Also, note that the number appearing on the report in the Amount column MUST be represented as a positive number, no matter what the actual transaction amount is.

In the summary, the net total should appear immediately after the $ and the number of transactions processed should appear immediately after the colon and a single space.

Make sure that your columnar alignment in the report is EXACTLY what you see above. Don't try to "correct" anything you see above, such as the alignment of the headers.


What You Are Expected To Submit

For this assignment, I want you to develop (but not turn in) a full top-down design including a module structure chart, and a Nassi-Shneiderman chart for each module box.

Then, of course, develop and test the actual program.

Submit the following: source code file (.c) and the output file from the test run of your program, using the data shown in the specs. Check your answers carefully!

Your source code filename should be YOUR first initial and last name and the addition _ie plus the .c extension (such as kjefferies-ie.c for me).
Your external filename for the input file must be c:\class\ie.txt If you have not yet created a c:\class folder for your data and output files, then do so prior to working on this program.
Your external filename for the output file should be c:\class\ plus YOUR first initial and last name and the addition -ie plus the .txt extension (such as c:\class\kjefferies-ie.txtfor me).

You must use these filenames and filename conventions and the c:\class directory to receive full credit.

Do not submit your input file or .exe file.

Be sure to include appropriate comments and indentation in your source code. You will continue to be graded on style.

More products