Advertisement
mrScarlett

Task 3 - PreRelease - 2018

Dec 30th, 2017
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. cowIds = [] //from task 1
  2. totalYield = [] //from task 1
  3. highestYield=0 //setting the highest yield to 0, low number
  4. highestCow=0 // setting the id for the cow with highest yield to 0, could be any number..
  5. daysUnderLimit=4 // constant for the days under yield limit
  6. FOR cow = 1 to noCows
  7. IF totalYield[cow]>highestYield // checks if the cow yield in current index position is > highestYield
  8. highestYield=totalYield[cow] // if true then highestYield is replace with current index value
  9. highestCow=cowIds[cow] // cowId is updated to cow ID in current index position
  10. END IF
  11.  
  12. IF under[cow]>=daysUnderLimit
  13. OUTPUT "Cow" , cowIds[cow], "was under yield ", under[cow], "times"
  14. END IF
  15. NEXT cow
  16. OUTPUT "The cow with the highest yield is", highestCow," with a yield of ", highestYield
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement