Advertisement
mrScarlett

Task 2 - PreRelease - 2018

Dec 30th, 2017
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. cowIds = [] // already populated from task 1
  2. totalYield = [] // already populated from task 1
  3. grandTotal = 0 //needed for task 2
  4.  
  5. FOR cow = 1 to noCows //loop for the number of cows in the herd, set from task 1
  6. grandTotal+=totalYield[cow] // increasing the value of grandTotal by the value in each index of the totalYield array
  7. OUTPUT "The average milk yield for ",cowIds[cow]," is ", totalYield[cow]/7 // output average daily yield for each cow
  8. NEXT cow
  9.  
  10. OUTPUT "The grand total of all cows is", grandTotal //outputs the grandtotal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement