One approach to designing algorithms is to solve the problem you want the computer to solve yourself. If you solve the problem yourself, you can then reflect upon the steps you took and instruct the computer to execute the same sequence of steps.
Take for example our payroll program. One of the events it must handle is the user clicking on the Calculate Pay button. When that occurs, we want the computer to calculate the gross pay, tax, net pay and total pay.
Devising an algorithm for that may be confusing at first, but if you try a few examples yourself, you will gain insight into the steps you are following. For example, what if someone works 10 hours at 10 dollars per hour. Can you figure out what the gross pay, tax, net pay and new total pay will be? You would probably do the following:
Once you understand the algorithm you are using, it should be fairly easy to translate that into Visual Basic:
Disclaimer: The views and opinions expressed on unofficial pages of California State University, Dominguez Hills faculty, staff or students are strictly those of the page authors. The content of these pages has not been reviewed or approved by California State University, Dominguez Hills.