Readfemale else output malename maleloss to

This preview shows page 20 - 24 out of 41 pages.

readFemale()elseoutput maleName, maleLoss to mergedFilereadMale()endifcheckEnd()returnfinishUp()close femaleFileclose maleFileclose mergedFile20
Programming Logic and Design, 7eSolutions 7-return6.a. The Curl Up and Dye Beauty Salon maintains a master file that contains arecord 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 transactionfile is produced. It contains a customer’s ID number, the service received (forexample, Manicure), and the price paid. Each file is sorted in ID number order.Design the logic for a program that matches the master and transaction file recordsand updates the total paid for each client by adding the current week’s price paid tothe cumulative total. Not all clients purchase services each week. The output is theupdated master file and an error report that lists any transaction records for which nomaster record exists.21
Programming Logic and Design, 7eSolutions 7-Pseudocode:startDeclarationsInputFile masterFileInputFile transFileOutputFile updatedFilenum masterIdstring masterFirstNamestring masterLastNamenum masterTotalnum transIdnum transTotalstring transServicestring areBothAtEnd= “N”num END_ID = 999getReady()while areBothAtEnd <> “Y”updateRecords()endwhilefinishUp()stopgetReady()open masterFile “CurlUpAndDyeMaster.txt”open transFile “CurlUpAndDyeTransactions.txt”open updatedFile “UpdatedClients.txt”readMaster()readTrans()checkEnd()return22
Programming Logic and Design, 7eSolutions 7-readMaster()input masterId, masterFirstName, masterLastName, masterTotalfrom masterFileif eof thenmasterId = END_IDendifreturnreadTrans()input transId, transService, transTotal from transFileif eof thentransId = END_IDendifreturncheckEnd()if masterId = END_ID thenif transId = END_ID thenareBothAtEnd = “Y”endifendifreturnupdateRecords()if transId = masterId thenmasterTotal = masterTotal + transTotaloutput masterId, masterFirstName, masterLastName,masterTotal to updatedFilereadMaster()readTrans()elseif transId > masterId thenoutput masterId, masterFirstName, masterLastName,masterTotal to updatedFilereadMaster()elseoutput “No master record for transaction ”, transIdreadTrans()endifendifcheckEnd()returnfinishUp()close masterFileclose transFileclose updatedFilereturn

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 41 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
N/A
Tags
NUM

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture