output Enter student name or QUIT to quit input name next name must be input

# Output enter student name or quit to quit input name

• Homework Help
• 77
• 98% (246) 240 out of 246 people found this document helpful

This preview shows page 64 - 68 out of 77 pages.

output "Enter student name or ", QUIT, " to quit " input name // next name must be input endwhile stop Debug06-03 // This program counts how many sales are made // in each of five categories of products start Declarations num category num SIZE = 5 num QUIT = 9 num sales[SIZE] = 0, 0, 0, 0, 0 string HEAD1 = "Sales" string HEAD2 = "Category Number of Sales" output "Enter category ", QUIT, " to quit " input category while category <> QUIT // category must be not equal to quit if category >= 1 AND category <= SIZE then // category can be equal to 1 or SIZE and still be valid sales[category - 1] = sales[category - 1] + 1 else output "Invalid category" endif output "Enter category ", QUIT, " to quit " input category // category must be input endwhile output HEAD1 output HEAD2 category = 0 // category should start at 0 if // it is used as sales subscript while category < SIZE output category + 1, sales[category] category = category + 1 endwhile stop 2. Your downloadable files for Chapter 6 include a file named DEBUG06-04.jpg that contains a flowchart with syntax and/or logical errors. Examine the flowchart and then find and correct all the bugs. Answer : 64
Programming Logic and Design, 8e Solutions 6- 65
Programming Logic and Design, 8e Solutions 6- Game Zone 1. Create the logic for a Magic 8 Ball game in which the user enters a question such as What does my future hold? The computer randomly selects one of eight possible vague answers, such as It remains to be seen. start Declarations num LIMIT = 8 num index string userQuestion string QUIT = “zzzz” string ANSWERS[LIMIT] = “As I see it, yes”, “It is certain”, “Signs point to yes”, 66