Answer A sample solution follows start Declarations InputFile masterFile

Answer a sample solution follows start declarations

This preview shows page 38 - 41 out of 41 pages.

38
Programming Logic and Design, 7e Solutions 7- output PROMPT, LIMIT input guess count = 1 gameCount = gameCount + 1 return playGame() while guess not equal to myRandomNumber if guess > myRandomNumber then output HIGH else output LOW endif input guess count = count + 1 endwhile output CORRECT output “It took ”, count, “ guesses!” if count < lowScore then lowScore = count endif startGame() return finishUp() displayRecords() close masterFile close updatedFile return getFilesReady() open masterFile “GuessingGame.txt” open updatedFile “BestScores.txt” readMaster() fileUpdated = “N” return readMaster() input masterName, masterScore from masterFile if eof then masterName = END_NAME endif return updateRecords() if playerName = masterName then output masterName, lowScore to updatedFile fileUpdated = “Y” else if playerName > masterName then output masterName, masterScore to updatedFile readMaster() else output playerName, lowScore to updatedFile 39
Programming Logic and Design, 7e Solutions 7- fileUpdated = “Y” endif endif return displayRecords() close updatedFile open updatedFile “BestScores.txt” input playerName, lowScore from updatedFile while not eof output playerName, lowScore input playerName, lowScore from updatedFile endwhile return Up for Discussion 11.Suppose that you are hired by a police department to write a program that matchesarrest records with court records detailing the ultimate outcome or verdict for each case. You have been given access to current files so that you can test the program. Your friend works in the personnel department of a large company and must perform background checks on potential employees. (The job applicants sign a form authorizing the check.) Police records are open to the public and your friend could look up police records at the courthouse, but it would take many hours per week. As aconvenience, should you provide your friend with outcomes of any arrest records of job applicants?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture