# Return finishup actualsize index if actualsize 0 then

• Homework Help
• 500
• 85% (26) 22 out of 26 people found this document helpful

This preview shows page 6 - 12 out of 500 pages.

return finishUp() actualSize = index if actualSize > 0 then A sample solution follows
avg = sum/actualSize index = 0 while index < actualSize output numbers[index], avg – numbers[index] index = index + 1 endwhile endif return 3. a. Design the logic for a program that allows a user to enter 12 numbers, then displays all of A sample solution follows
index = index + 1 return finishUp() index = 0 while index < SIZE output numbers[index] index = index + 1 endwhile output largest, smallest return b. Modify the program in Exercise 3a so that the user can enter any amount of numbers up to 12 un
input numbers[index] if numbers[index] > largest then largest = numbers[index] else if numbers[index] < smallest then smallest = numbers[index] endif endif index = index + 1 output “Do you want to enter more numbers? (Y/N)” input moreNumbers return finishUp() actualSize = index if actualSize > 0 then index = 0 while index < actualSize output numbers[index] index = index + 1 endwhile output largest, smallest endif return 4. a. Registration workers at a conference for authors of children’s books have collected data a
endwhile finishUp() stop getReady() output “Enter the author’s name or ”, QUIT, “ to quit ” input name return collectData() output “Enter the number of books written and target reader age ” input numBooks, age if (numBooks >= 1 AND numBooks <= MAX_BOOKS) AND (age >= 0 AND age <= MAX_AGE) then bookCnt[numBooks-1] = bookCnt[numBooks-1] + 1 else output “Invalid data, record not counted” endif output “Enter the author’s name or ”, QUIT, “ to quit ” input name return finishUp() numBooks = 0 while numBooks < SIZE output numBooks+1, bookCnt[numBooks] numBooks = numBooks + 1 endwhile return b. Modify the registration program so that the output is a list of how many participants have wri
string name