(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
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
C How to Program (8th Edition)
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_forwardPlease choose the correct answer without explaining.. Thank youarrow_forwardUse python pleasearrow_forward
- File 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_forwardWrite example of C++ program that reads and writes a binary file to a text file. It also prints the values accordingly to the consolearrow_forward
- Make 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_forwardThe three most important file structure approaches should be described.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