expand icon
book Programming Logic and Design, Introductory 7th Edition by Joyce Farrell cover

Programming Logic and Design, Introductory 7th Edition by Joyce Farrell

النسخة 7الرقم المعياري الدولي: 1285225562
book Programming Logic and Design, Introductory 7th Edition by Joyce Farrell cover

Programming Logic and Design, Introductory 7th Edition by Joyce Farrell

النسخة 7الرقم المعياري الدولي: 1285225562
تمرين 5

a. Registration workers at a conference for authors of children’s books have collected data about conference participants, including the number of books each author has written and the target age of their readers. The participants have written from 1 to 40 books each, and target readers’ ages range from 0 through 16. Design a program that continuously accepts the number of books written until a sentinel value is entered, and then displays a list of how many participants have written each number of books (1 through 40).

b. Modify the author registration program so that a target age for each author’s audience is input until a sentinel value is entered. The output is a count of the number of books written for each of the following age groups: under 3, 3 through 7, 8 through 10, 11 through 13, and 14 and older.

الحلول خطوة بخطوة
موثّق
like image
like image

الخطوة 1 من3

The following code inputs books for each citizen until an appropriate sentinel value is entered.

Pseudo code:

start

Declarations

num books[40]

num ages[40][16]

num i

num j

num end = 1

num readers

for i = 0 to 21 step 1

output “Enter Book Author: ”

input books [i]

j = 0

while end <> 0

output “Enter Age”

input ages[i][j]

if ages[i][j] = -1 then

end=0

endif

j = j+1

endwhile

endfor

output “Number of Participants written books :”

for i = 0 to 21 step 1

j = 0

readers = 0

while ages[i][j] <> -1

readers = readers +1

j = j+1

endwhile

output books [i], “ “ , readers

endfor

stop


الخطوة 2 من 3


الخطوة 3 من 3

close menu
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
cross icon