C++ code
The Curl Up and Dye Beauty Salon maintains a master file that contains a record for each of its clients. Fields in the master file include the client’s ID number, first name, last name, and total amount spent this year. Every week, a transaction file is produced. It contains a customer’s ID number, the service received (for example, Manicure), and the price paid. Each file is sorted in ID number order.
a. Design the logic for a program that matches the master and transaction file records and updates the total paid for each client by adding the current week’s price paid to the cumulative total. Not all clients purchase services each week. The output is the updated master file and an error report that lists any transaction records for which no master record exists.
// Start
// Declarations
// InputFile masterFile;
// InputFile transactionFile;
// OutputFile newMasterFile;
// num mClientNumber, mtotalClientCost, tClientNumber,
titemClientCost
// string mClientfName, mClientlName
// output "Master File Updating Starting"
// open masterFile "Master.rtf"
// open transactionFile "Transaction.rtf"
// open newMasterFile "newMaster.rtf"
// read mClientNumber, mClientfName, mClientlName, mtotalClientCost
from masterFile
// read tClientNumber, titemClientCost from transactionFile
// while ( transactionFile not EOF )
// while (( masterFile not EOF) and (mClientNumber <
tClientNumber))
// output mClientNumber, mClientfName, mClientlName,
mtotalClientCost to newMasterFile
// read mClientNumber, mClientfName, mClientlName,
mtotalClientCost from masterFile
// endwhile
// if (masterFile is EOF)
// output "Error Client ID: ", tClientNumber, " not in Master
File."
// else if (mClientNumber == tClientNumber) then
// mtotalClientCost = mtotalClientCost + titemClientCost
// output mClientNumber, mClientfName, mClientlName,
mtotalClientCost to newMasterFile
// read mClientNumber, mClientfName, mClientlName,
mtotalClientCost from masterFile
// else if (mClientNumber > tClientNumber) then
// output "Error Client ID: ", tClientNumber, " not in Master
File."
// endif
// read tClientNumber, titemClientCost from transactionFile
// endwhile
// while (masterFile not EOF)
// output mClientNumber, mClientfName, mClientlName,
mtotalClientCost to newMasterFile
// read mClientNumber, mClientfName, mClientlName,
mtotalClientCost from masterFile
// endwhile
// output "Master File Updating Complete"
// close masterFile
// close transactionFile
// close newMasterFile
// Stop
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images
- Python How to read a file into a dictionary when key is on the first line of the text and value is on the second line of the text Example of the text file: Alabama (should be assign as key) Montgomery (should be assign as value) Alaska Juneau Arizona Phoenixarrow_forwardA movie file has the following record structure:name ofthe movie producer director type productioncostAssume that the name of the movie is the primary key of the file. Thefield type refers to the type of the movie, for example, drama, sci-fi, horror, crimethriller, comedy and so forth. Input a sample set of records of your choice into themovie file.i) Implement a primary index-based ISAM file organization.ii) Implement secondary indexes on director, type and productioncost.arrow_forward74. The file which consists of the ordering fields for records is called a. sequential file b. ordered file c. spanned file d. both a and barrow_forward
- This is the most effective file organization method in which one must handle all data records in a file namedarrow_forwardIn the Properties box, pick Edit File Attributes from the menu that displays to alter a file attribute.arrow_forwardThe following record structure describes a movie file: the title of the film, the director's style, and the budget Assume that the file's primary key is the title of the film. The field type describes the genre of the film, such as drama, science fiction, horror, crime thriller, comedy, etc. Enter a sample set of records into the movie file of your choosing.i) Create a primary ISAM file organisation system based on indexes.ii) Put in place supplementary indexes for the director, type, and cost of production.iii) How may Programming Assignment 3's secondary index-based file organisation be utilised to respond to a question like "Which directors have overseen comedies or dramas that have incurred the highest production costs?arrow_forward
- Which concept in access control places restrictions on a user's access to the particular data that is necessary for him or her to complete the task that has been given to him or her?arrow_forwardThe name given to the file that stores ordering characteristics that are not of a key-like form is thearrow_forward6. Tailacess.log will returns lastarrow_forward
- The header record of a batch file contains totals of items in the file. Each time the file is processed, the totals are also updated. Nightly, after the batch processes, the relevant data fields are summed and compared with the totals. Unbalanced conditions are reported and corrected. This example describes: a) Segregation of duties b) Application output control c) Application edit check d) Applicaiton input controlarrow_forwardCodearrow_forwardComputer Algortihm Lab You are doing summer internship at Google and to check your skills you are allotted a task to develop an algorithm that performs the IRUD operations on the records in a file name “file01” which consist of Index_number, Cust_name, Cust_address fields.arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY