100%(18)18 out of 18 people found this document helpful
This preview shows page 17 - 19 out of 18 pages.
Find the Bugs1.Your downloadable files for Chapter 1 include DEBUG01-01.txt, DEBUG01-02.txt, and DEBUG01-03.txt. Each file starts with some comments (lines that begin with twoslashes) that describe the program. Examine the pseudocode that follows theintroductory comments, then find and correct all the bugs.
Programming Logic and Design, 9eSolutions 1-18// milesPerGallon is computed using divisionoutput milesPerGallon// miles is misspelled, and the P in milesPerGallon should be uppercasestop// Program should end with stopDEBUG01-03// This pseudocode is intended to describe// computing the per day cost of your rent// in a 30-day monthstartinput rentcostPerDay = rent / 30// Comment indicates 30-day monthoutput costPerDay// output should be costPerDaystop2.Your downloadable files for Chapter 1 include a file named DEBUG01-04.jpg that contains a flowchart that contains syntax and/or logical errors. Examine the flowchartand then find and correct all the bugs.1.Create the logic for a Mad Lib program that accepts five words from input, then creates and displays a short story or nursery rhyme that uses them.
Programming Logic and Design, 9eSolutions 1-19Answer:Students’ answers will vary. But a simple solution could be:startinput word1input word2input word3input word4 input word5output “Jack and Jill went up the ”, word1,“ to fetch a pail of ”, word2,“. “Jack ”, word3,“ down and broke his ”, word4,“and Jill came ”, word5,“ after.”stop