home / study / questions and answers / engineering / computer science / a. regis
ID: 674875 • Letter: H
Question
home / study / questions and answers / engineering / computer science / a. registration workers at a conference for authors ... Question -------------------------------------------------------------------------------- a. Registration workers at a conference for authors of childrens 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 readersages range from 0 through 16. Design a pseudocode that continuously accepts an authors name, number of books written, and target reader age until a sentinel value is entered. Then display a list of how many participants have written each number of books (1 through 40). b. Modify the author registration pseudocode so that the output is a list of how many participants have written 1 to 5 books, 6 to 12 books, and 13 or more books. c. Modify the author registration pseudocode so that 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
Explanation / Answer
1)
1)
string author_Name[30];
int number_books[30];
int age[30];
int iter=0;
while(true){ //reading under sentinel entered..(999)
printf("Enter age: ");
read age;
if(age === 999){
break;
}
print("Enter number of books: ");
read books;
print("Enter author name: ");
read name;
//storing data
author_Name[iter] = name;
number_books[iter] = books;
age[iter] = age;
iter++;
}
//printng data
for(int i=0;i<iter;i++){
print(author_Name[i]);
print(number_books[i]);
print(age[i]);
}
------------------------------------------------------------------------------------------------------------------------------------------
2)
1)
string author_Name[30];
int number_books[30];
int age[30];
int> int sixToTwelve = 0;
int above = 0;
int iter=0;
while(true){ //reading under sentinel entered..(999)
printf("Enter age: ");
read age;
if(age === 999){
break;
}
print("Enter number of books: ");
read books;
if(books >= 1 & books<= 5){
oneToFive++;
}
else if(books >= 6 & books<= 12){
sixToTwelve++;
}
else if(books > 12){
above++;
}
print("Enter author name: ");
read name;
//storing data
author_Name[iter] = name;
number_books[iter] = books;
age[iter] = age;
iter++;
}
//printng data
for(int i=0;i<iter;i++){
print(author_Name[i]);
print(number_books[i]);
print(age[i]);
}
//printng results
print("between 1 to 5 are: ",oneToFive);
print("between 6 to 12 are: ",sixToTwelve);
print("Above 12: ",above);
---------------------------------------------------------------------------------------------------------------------------------------
3)
1)
string author_Name[30];
int number_books[30];
int age[30];
int under3=0;
int threeToSeven = 0;
int eightToTen = 0;
int elevenToThirteen = 0;
int above;
int iter=0;
while(true){ //reading under sentinel entered..(999)
printf("Enter age: ");
read age;
if(age === 999){
break;
}
print("Enter number of books: ");
read books;
if(age <3){
under3++;
}
else if(age >= 3 & books<= 7){
threeToSeven++;
}
else if(age >= 8 & books<= 10){
eightToTen++;
}
else if(age >= 11 & books<= 13){
elevenToThirteen++;
}
else if(age>13){
above++;
}
print("Enter author name: ");
read name;
//storing data
author_Name[iter] = name;
number_books[iter] = books;
age[iter] = age;
iter++;
}
//printng data
for(int i=0;i<iter;i++){
print(author_Name[i]);
print(number_books[i]);
print(age[i]);
}
//printng results
print("Age under 3: ",under3);
print("Age 3 through 7: ",threeToSeven);
print("Age 8 through 10: ",eightToTen);
print("Age 11 through 13: ",elevenToThirteen);
print("Above 13: ",above);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.