Problem about counting integral

You might benefit from reading chapters 19-21 in
http://www.appinventor.org/book2
from