Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// Pseudocode PLD Chapter 7 #6a pg. 301 // Start // Declarations // InputFile masterFile; // InputFile transactionFile; // OutputFile newMasterFile; // num mClientNumber, mtotalClientCost,

// Pseudocode PLD Chapter 7 #6a pg. 301 // 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

I can't get it to run with the following

5 Mike Smith 2098.72 6 Sue Nathan 1234.32 100 Bobby Jones 519.69 125 Sally Mayer 345.74 200 Danny Glover 5623.18

1 568.34 5 345.10 6 1012.43 17 2045.12 100 1231.00 101 167.39 125 5239.67

The ones that are listed aren't working

This is what I have. Can't figure out the mistake

#include #include #include using namespace std; int main() { ifstream masterFile; ifstream transactionFile; ofstream newMasterFile; int mClientNumber, mtotalClientCost, tClientNumber, titemClientCost; string mClientfName, mClientlName; cout<<"Master File Updating Starting"; masterFile.open("Master.txt"); transactionFile.open("Transaction.txt"); newMasterFile.open("newMaster.txt"); masterFile >>mClientNumber; masterFile >>mClientfName; masterFile >>mClientlName; masterFile >>mtotalClientCost; transactionFile >>tClientNumber; transactionFile >>titemClientCost; while(!transactionFile.eof()) { while((!masterFile.eof()) && (mClientNumber < tClientNumber)) { newMasterFile <>mClientNumber; masterFile >>mClientfName; masterFile >>mClientlName; masterFile >>mtotalClientCost; } if(masterFile.eof()) { cout<<"Error Client ID: "<> mClientNumber; masterFile >> mClientfName; masterFile >> mClientlName; masterFile >> mtotalClientCost; } else if (mClientNumber > tClientNumber) { cout<<"Error Client ID: "<>tClientNumber; transactionFile >>titemClientCost; } while(!masterFile.eof()) { newMasterFile << mClientNumber<<" " <>mClientNumber; masterFile >>mClientfName; masterFile >>mClientlName; masterFile >>mtotalClientCost; } cout<<"Master File Updating Complete"<

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions