(File Matching) Exercise 11.3 asked the reader to write a series of single statements. Actually, these statements form the core of an important type of file-processing program, namely, a file-matching program. In commercial data processing, it’s common to have several files in each system. In an accounts receivable system, for example, there’s generally a master file containing detailed information about each customer such as the customer’s name, address, telephone number, outstanding balance, credit limit, discount terms, contract arrangements and possibly a condensed history of recent purchases and cash payments.
As transactions occur (i.e., sales are made and cash payments arrive in the mail), they’re entered into a file. At the end of each business period (i.e., a month for some companies, a week for others and a day in some cases) the file of transactions (called “trans.dat” in Exercise 11.3) is applied to the master file (called “oldmast.dat” in Exercise 11.3), thus updating each account’s record of purchases and payments. After each of these updates runs, the master file is rewritten as a new file (“newmast.dat”), which is then used at the end of the next business period to begin the updating process again.
File-matching programs must deal with certain problems that do not exist in single-file programs. For example, a match does not always occur. A customer on the master file might not have made any purchases or cash payments in the current business period, and therefore no record for this customer will appear on the transaction file. Similarly, a customer who did make some purchases or cash payments might have just moved to this community, and the company may not have had a chance to create a master record for this customer.
Use the statements written in Exercise 11.3 as the basis for a complete file-matching accounts receivable program. Use the account number on each file as the record key for matching purposes. Assume that each file is a sequential file with records stored in increasing account number order.
When a match occurs (i.e., records with the same account number appear on both the master file and the transaction file), add the dollar amount on the transaction file to the current balance on the master file and write the “newmast.dat” record. (Assume that purchases are indicated by positive amounts on the transaction file, and that payments are indicated by negative amounts.) When there’s a master record for a particular account but no corresponding transaction record, merely write the master record to “newraast.dat”. When there’s a transaction record but no corresponding master record, print the message “Unmatched transaction record for account number...“ (fill in the account number from the transaction record).
Want to see the full answer?
Check out a sample textbook solutionChapter 11 Solutions
MYPROGRAMMINGLAB WITH PEARSON ETEXT
Additional Engineering Textbook Solutions
C++ How to Program (10th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Computer Science: An Overview (12th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Java How To Program (Early Objects)
- In C Programming Language. - use user-defined functions.- use an array of arrays.- use file pointers- use string processing and character conversions.- use a dynamic memory function calloc() or malloc() - Demonstrate the ability to read a file and process the data. Problem: You are tasked to write a program that will perform a statistical analysis of student records. Your program will open a text file (provided) and store the values read into an array (2d). Your program will then close the input file and process the data. Your program will print out the records to screen and will then print out the average quiz scores per student.For each student in the provided text input file there is a name of up to 20 characters, an id number of five alphanumeric values (n1234), 4 exm grades in order: exm 1 – exm 4.You may use a fixed 2d array size of 80 characters for the input file name. You must use a dynamic array for at least one task in your program. You may declare your filename array using…arrow_forwardC programming language **Please put comments when needed. ** I send two exercises. They all need to be in one file. I need the code of the second one BUT SINCE I MAKE MISTAKE EVERYTIME I AM PUTING TWO OR MORE EXERCISES IN ONE FILE, I JUST WANT TO SEE HOW TO DO IT WELL. **SO PLEASE IF YOU CAN, DO ALL OF THEM IN THE SAME C FILE? AND MAKE SURE IT RUNS GREAT.arrow_forwardPlease choose the correct answer without explaining.. Thank youarrow_forward
- Contiguous Memory Allocation Algorithms The program will read size of free memory partitions and size of processes from a text file and then will try to allocate a memory partition for each process using the first-fit, best-fit and worst-fit allocation algorithms. The implementation completed in Python programming language. The first line of the input file should contain the size of free memory partitions (in order) while the second line contains the size of processes (in order). Sample input file is shown below: 300,600,350,200,750,125 115,500,358,200,375 The program should read the name input file as command line input and produce a text file named “output.txt” with the following example output: First-Fit Memory Allocation ----------------------------------------------------------------------------------------------- start => 300 600 350 200 750 125 115 => 115* 185 600 350 200 750 125 500 => 115* 185 500* 100 350 200 750 125 358…arrow_forwardFile Handling with Array: C++ Language: Write a c++ program to read the data from the file into array and do calculation. Note: Take a general word problem and write syntax which will use in all problems related to file handling with array.arrow_forwardHELLO please solve in c++. SHOW THE OUTPUT. INSTRUCTIONS ARE DOWN BELOW PLEASE COMPLETE.arrow_forward
- Write example of C++ program that reads and writes a binary file to a text file. It also prints the values accordingly to the consolearrow_forwardMake a distinction between file storage structure and structure storage structure.arrow_forwardprogramming language : c++ NOTE : YOU HAVE TO USE FILE HANDLING question : make a programm in c++ that ask user for the number of students whose records must be inserted in file. Afterwards, take records from user, calculate grade of students and store all records in a file.arrow_forward
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning