Did you look at the samples that ship with your dev tools? I'm pretty sure there is a demo "GPACalc" somewhere that calculates your grade point average when you press a button.
Also see this thread, and please learn to use the Search button on the forum.
Need some help with buttons