C How to Program (8th Edition)
C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 11, Problem 11.8E

(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).

Blurred answer
Students have asked these similar questions
- Print the Movie names, list of actors/actresses, ratings(number of tickets sold), ticket prices, cost of production and the total net profit of each movie(net_profit_of_movie)b) Write a function that calculates the net_profit_of_movie; which is the multiplication of ticket prices and ratings(number of tickets sold), subtracted by cost of production c) In main call function, print all movies’ information and the net_profit_of_movie to the console. d) Create a file called movies.txt and write all movies information to the file, including the net_profit_of_movie per movie. e) Ask the user to add more movies (use realloc). The user needs to write at least 1 more movie (e.g. movie 4) then get all information for the new movies from the user. Create a file called UpdatedMovies.txt and write all movie data including the lately added movies’ data onto the file UpdatedMovies.txt.f) Write (Mohammad) and (63223) at the top of the code. g) Write explanatory comments for your code
- In C++ using Visual Studio - Seperate the files if there is any .cpp, .main or .h files. PART 1Read the contents of the text file and store them in a C++ data structure called std::map<string, int>This map is a collection of sorted <key, value> pairsIn this case, the keys are unique words found in the text file, and the values represent the number of times each word appearsFor example, since the word "cat" appears twice in the file, then map["cat"] = 2 PART 2Iterate through the map and print each key in the order they appearThis will give you a sorted list of unique wordsHere's the expected result: "a big cat does everything feeding goats helping injured juvenile kangaroos locating missing notorious objects playing quietly reading superb tales upvoting videos with xylophone yielding zebras" PART 3Iterate through the map again, this time printing each associated valueThe values represent how many times each word was found in the text filePay attention to the sequence of…
Practice problem we were given in C++ to review for test. Thanks Write a program that reads data from a data file, the value of which is provided at the end of the problem. Your program is to incorporate the following requirements: Data to the program is input from a file of an unspecified length; that is, the program does not know in advance how many numbers are in the file. Save the output of the program in a file. Write a function called getNumber which reads a number from the input file, outputs the number to the output file and the monitor and sends the input number to the function main. Make sure, both input and out file are being opened in the main program. Write a function called classifyNumber which counts number of even, odd, and zero (occurrences of zero) available in the input file. Have the program find the sum and average of the numbers and print only 10 numbers per line. Write a function called printResult so that it outputs (in output file and monitor) even number of…
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Instruction Format (With reference to address); Author: ChiragBhalodia;https://www.youtube.com/watch?v=lNdy8HREvgo;License: Standard YouTube License, CC-BY