But I am stacked with the method findAccountByOwnerId(), the problem is with returning the value from the method. I do not know what am doing wrong here. Line 30 gives me an error.
Any help will be appreciated.
A method with a return value must in all cases return a value. Here, it may not, if there is no account with ID id. You may assume that there will always be such an account, but you need to convince the compiler that it will always have an Account object to return (or possibly return null otherwise).
Don't write a loop like this, without enclosing braces. My personal rule is that I *may* omit the braces if the for or if contains only a single line of code, but I rarely do. Probably rather sooner than later the time will come to add a second statement, at which point you need to remember to add braces anyway. Plus, it makes the code clearer to read for other people, or yourself, six months down the road.