//  College maintains a master file of students and credits earned. // Each semester the master is updated with a transaction file // that contains Student ID and credits earned during the semester. // Each file is sorted in Student ID number order. Student name only exists in the master file. start Declarations num masterID string masterName num masterCredits num transID string bothDone = “N” num HIGH_VALUE = 999999 InputFile master InputFile trans OutputFile newMaster getReady() while bothDone = “N” detailLoop() endwhile allDone() stop getReady() open master “studentFile.dat” open transaction “semesterCredits.dat” open newMaster “updatedStudentFile.dat” readMaster() readTrans() checkBoth() return readMaster() input masterID, masterName, credits from master if eof then masterID = HIGH_VALUE endif return readTrans() input transID, transCredits from trans if eof then transID = HIGH endif return checkBoth() if masterID = HIGH_VALUE OR transID = HIGH_VALUE then bothDone = “Y” endif return detailLoop() if masterID = transID then match() else if masterID > transID then noMasterForTrans() else noTransForMaster() endif endif checkBoth() return match() masterCredits = masterCredits + transCredits output masterID, masterName, masterCredits to newMaster readMaster() readTrans() return noMasterForTrans() output “No master file record matches transaction “, transID readTrans() return noTransForMaster() output masterID, masterName, masterCredits to newMaster readMaster() return allDone() close master close trans close newMaster return

In this program, the college maintains a master file of students and the credits they have earned. Each semester, the master file is updated with a transaction file that contains the Student ID and the credits earned during that semester. Both files are sorted in Student ID number order, and the master file also includes the student’s name.

The program starts by declaring variables such as masterID (the Student ID in the master file), masterName (the student’s name in the master file), masterCredits (the credits earned by the student in the master file), transID (the Student ID in the transaction file), and bothDone (a flag indicating whether both files have been processed).

The program then opens the master file, the transaction file, and a new master file to store the updated information. It also calls the getReady function, which initializes the program.

In the main loop of the program, called the detailLoop, the program compares the Student IDs in the master and transaction files. If they match, the match function is called, which updates the masterCredits by adding the transCredits (credits earned during the semester). If the masterID is greater than the transID, the noMasterForTrans function is called, which outputs a message indicating that there is no master file record that matches the transaction. If the transID is greater than the masterID, the noTransForMaster function is called, which outputs the information from the master file to the new master file and reads the next record from the master file. After each iteration of the detailLoop, the program checks if both files have been fully processed by calling the checkBoth function. If either masterID or transID is equal to a HIGH_VALUE (999999 in this case), the bothDone flag is set to “Y”, indicating that both files have been processed.

Once both files have been fully processed, the program calls the allDone function, which closes all the files and stops the program.

The structure of this program is designed to efficiently update the master file with the credits earned during each semester by comparing the Student IDs in both files. The program ensures that all records in both files are processed and updates the master file accordingly.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.

Click Here to Make an Order Click Here to Hire a Writer