Program accepts a student year in school


Discuss the below:

// Program accepts a student's year in school (1 to 4)
// and the number of cans collected for a recycling drive.
// Output is a report that lists each class year and
// the total number of cans collected by that class.
start
num year
num cans
num SIZE = 4
num collected[SIZE] = 0, 0, 0
string HEAD1 = "Can Recycling Report"
string HEAD2 = "Year Cans Collected"
input year, cans
while not eof
collected[year] = collected[year - 1] + cans
input year, cans
endwhile
print HEAD1
print HEAD2
year = 1
while year <= year
output year, collected[year - 1]
endwhile
stop

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Program accepts a student year in school
Reference No:- TGS01931776

Now Priced at $20 (50% Discount)

Recommended (94%)

Rated (4.6/5)