Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cowIds = [] //from task 1
- totalYield = [] //from task 1
- highestYield=0 //setting the highest yield to 0, low number
- highestCow=0 // setting the id for the cow with highest yield to 0, could be any number..
- daysUnderLimit=4 // constant for the days under yield limit
- FOR cow = 1 to noCows
- IF totalYield[cow]>highestYield // checks if the cow yield in current index position is > highestYield
- highestYield=totalYield[cow] // if true then highestYield is replace with current index value
- highestCow=cowIds[cow] // cowId is updated to cow ID in current index position
- END IF
- IF under[cow]>=daysUnderLimit
- OUTPUT "Cow" , cowIds[cow], "was under yield ", under[cow], "times"
- END IF
- NEXT cow
- OUTPUT "The cow with the highest yield is", highestCow," with a yield of ", highestYield
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement