How to create a payroll program with qbasic

Written by darrin koltow
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to create a payroll program with qbasic
Stepping through a QBasic payroll program helps you locate its errors. (Jupiterimages/Photos.com/Getty Images)

A payroll program is a software-based tool for managing the amounts and dates related to paying your employees. The statements of the programming language QBasic let you write such a program. If you want to write a QBasic payroll program from scratch, it's best to first try out other payroll programs (in any language) and then write a detailed description of your program. Making a payroll program with QBasic, as opposed to other high-level programming languages like C and Java, lets you quickly fix bugs when they occur, because QBasic doesn't require the additional step of compilation.

Skill level:
Moderately Challenging

Other People Are Reading

Instructions

  1. 1

    Print the source code for an open-source payroll program written in any programming language. Example programs include Anahaw, Enterprise and Piccolo. You'll translate the statements of these programs from their original programming language to QBasic. Unfortunately, open-source QBasic programs are scarce to nonexistent on the Web.

  2. 2

    Write at the top of a piece of paper three words from left to right: "Variable," "Value" and "Purpose." The "Variable" column will list each variable in the payroll program. The "Value" column will contain the values those variables take on when the program's statements are executed. The "Purpose" column will contain your description of the variable's purpose, which you'll infer from the way the program changes the variable's values as you trace through the program.

  3. 3

    Place a mark on the top statement in the source file you printed in Step 1 that holds the function labelled "main." Jot down in the "Values" column of the variables list the values of any variables in that first statement. This step begins a process of tracing through the original program's source code. Tracing through a program is the same as executing its code one statement at a time. Although you can't execute code by hand, you can follow the flow of execution that the running program will take. Doing so is an excellent way of understanding how a program works.

  4. 4

    Erase the mark on the previous statement and place it on the next one down. Write down the values for any variables affected by this statement, as you did the top most statement. Continue moving the current statement mark to each successively lower statement in the file and updating the "Values" column.

  5. 5

    Write, in the "Purpose" column, a description of the purpose of each variable you're tracking. You won't know the purpose for all variables at first, but you will after several sessions of tracing through the program completely. You can often determine a variable's purpose simply by interpreting its name, if the name is clear. For example, the variable "nextPayDate" likely holds the date of the next time payroll must be disbursed. Your goal is to write a descriptive comment for each variable in the program. Once you can do that and are familiar with QBasic syntax, you can move to the next step and translate the original program's statements to QBasic.

  6. 6

    Read through a description of QBasic's syntax. Your QBasic programming editor or development environment will have this description in its documentation or online help system.

  7. 7

    Translate each statement of the original payroll program to QBasic, then run the completed QBasic program.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.