Num masterhrlyrate num transjobnum string

This preview shows page 28 - 33 out of 41 pages.

num masterHrlyRatenum transJobNumstring transAddressstring transCustNamenum transIdnum transHrsWorkednum grossPaystring areBothAtEnd= “N”num END_ID = 999getReady()while areBothAtEnd equal to “Y”updateRecords()endwhilefinishUp()stopgetReady()open masterFile “TimelyTalentMaster.txt”open transFile “TimelyTalentAtMostOneTransactionPerWorker.txt”open updatedFile “WeeklyJobs.txt”readMaster()readTrans()checkEnd()returnreadMaster()input masterId, masterFirstName, masterLastName, masterAddress, masterHrlyRate from masterFileif eof thenmasterId = END_IDendifreturnreadTrans()input transJobNum, transAddress, transCustName, transId,transHrsWorked from transFileif eof thentransId = END_IDendifreturncheckEnd()if masterId = END_ID thenif transId = END_ID thenareBothAtEnd = “Y”endifendifreturnupdateRecords()if transId = masterId thengrossPay = masterHrlyRate * transHrsWorked28
Programming Logic and Design, 7eSolutions 7-output transJobNum, masterId, transHrsWorked, masterHrlyRate, grossPay to updatedFilereadMaster()readTrans()elseif transId > masterId thenreadMaster()elseoutput “No master record for transaction ”, transIdreadTrans()endifendifcheckEnd()returnfinishUp()close masterFileclose transFileclose updatedFilereturnb. Modify the help agency program so that any temporary worker can work any number of separate jobs in a week. Print one line for each job that week.
29
Programming Logic and Design, 7eSolutions 7-Pseudocode:startDeclarationsInputFile masterFileInputFile transFileOutputFile updatedFilenum masterIdstring masterFirstNamestring masterLastNamestring masterAddressnum masterHrlyRatenum transJobNumstring transAddressstring transCustNamenum transIdnum transHrsWorkednum grossPaystring areBothAtEnd= “N”num END_ID = 99930
Programming Logic and Design, 7eSolutions 7-getReady()while areBothAtEnd equal to “Y”updateRecords()endwhilefinishUp()stopgetReady()open masterFile “TimelyTalentMaster.txt”open transFile “TimelyTalentMultipleTransactionsPerWorker.txt”open updatedFile “WeeklyJobs.txt”readMaster()readTrans()checkEnd()returnreadMaster()input masterId, masterFirstName, masterLastName, masterAddress, masterHrlyRate from masterFileif eof thenmasterId = END_IDendifreturnreadTrans()input transJobNum, transAddress, transCustName, transId,transHrsWorked from transFileif eof thentransId = END_IDendifreturncheckEnd()if masterId = END_ID thenif transId = END_ID thenareBothAtEnd = “Y”endifendifreturnupdateRecords()if transId = masterId thengrossPay = masterHrlyRate * transHrsWorkedoutput transJobNum, masterId, transHrsWorked, masterHrlyRate, grossPay to updatedFilereadTrans()elseif transId > masterId thenreadMaster()elseoutput “No master record for transaction ”, transIdreadTrans()endifendifcheckEnd()return31
Programming Logic and Design, 7eSolutions 7-finishUp()close masterFileclose transFileclose updatedFilereturn

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture