Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cowIds = [] // already populated from task 1
- totalYield = [] // already populated from task 1
- grandTotal = 0 //needed for task 2
- FOR cow = 1 to noCows //loop for the number of cows in the herd, set from task 1
- grandTotal+=totalYield[cow] // increasing the value of grandTotal by the value in each index of the totalYield array
- OUTPUT "The average milk yield for ",cowIds[cow]," is ", totalYield[cow]/7 // output average daily yield for each cow
- NEXT cow
- OUTPUT "The grand total of all cows is", grandTotal //outputs the grandtotal
Advertisement
Add Comment
Please, Sign In to add comment