Question: Each code segment below starts with some comments ( lines that begin with two slashes ) that describe the program. Examine the pseudocode that follows

Each code segment below starts with some comments (lines that begin with two
slashes) that describe the program. Examine the pseudocode that follows the
introductory comments, then find and correct all the bugs as specified in the homework assignment instructions file.
// A high school is holding a recycling competition, and this program // allows a user to enter a student's year in school(1 through 4) and // number of cans collected for recycling. Data is entered continuously // until the user enters 9 for the year. After headings, output is four // lines -- one for each school year class.
start
Declarations
num year
num cans
num SIZE =0
num QUIT =9
num collectedArray[SIZE]=0,0,0
string HEAD1= "Can Recycling Report"
string HEAD2= "Year Cans Collected
output "Enter year of student or ", QUIT, " to quit "
output year
while year not QUIT
output "Enter number of cans collected "
input cans
collectedArray[year]= collectedArray[year]+ cans
output "Enter year of student or ", QUIT, " to quit "
output year
endwhile
output HEAD1
and HEAD2
year =1
while year < SIZE
output year, collectedArray[year]
year = year +1
end
end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!