Question
design a program for the following. Registration workers at a conference for authors of children's book have collected data about conference participants, including the number of book each author has written and the target age of their readers. The participants have written for 1 to 40 books each, and target reader's 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 display a list of how many participants have written each number of books (1 through 40).
Answers
you can probably adapt this little perl ditty to your needs. Other languages may be more verbose, however.
my %authors,%ages,%counts;
while (<>) {
last unless $_;
my ($count,$age,$name) = split(/\s+/,$_,3);
$authors{$name} = [$count,$age];
$ages{$age}++;
$counts{$count}++;
}
foreach my $c (1..40) {
printf "%2d: %3d\n",$c,$counts{$c};
}
my %authors,%ages,%counts;
while (<>) {
last unless $_;
my ($count,$age,$name) = split(/\s+/,$_,3);
$authors{$name} = [$count,$age];
$ages{$age}++;
$counts{$count}++;
}
foreach my $c (1..40) {
printf "%2d: %3d\n",$c,$counts{$c};
}
can this be written in pseudoode?
Related Questions
The purpose of evaluating children in a day care program is to
A. compare them with the other...
A software program features an electronic coloring book, in which children get to paint
characters...
Need help creating pseudocode for the following. Registration workers at a conference for authors...
When referring to a book in an APA paper, how do I write this? Do I only write the book name, only i...