CIS105 -
Programming Module
Lab Assignment 1 (turn in source code listing and sample output) - Points: _____
The objective of this lab assignment is to introduce you to programming and the QBASIC
programming environment. Enter the program below, save it, executed, print source code,
and print the sample output as instructed. Test the program with the test data provided.
Programming Environment: MS DOS QBASIC
Start > Classes > Structured Classes > CIS105 > QBASIC
Press ESCape to enter the editor
Enter the program listed below:
REM PROG1.BAS (your name and the time the class meets goes here)
REM This program calulates an employee's gross pay based on
REM the hourly rated and hours entered.
REM N$ String Name A$ String Answer to prompt (Y/N)
REM HR Numeric Hourly Rate HW Numeric Hours Worked
REM GP Numeric Gross Pay
CLS
PRINT "PROG1.BAS Juan Marquez TR 10:30"
PRINT
INPUT.RTN:
REM *** Input Routine ***
INPUT "Enter employee name: ", N$
INPUT " Enter hourly rate: ", HR
INPUT " Enter hours worked: ", HW
REM *** Processing Routine ***
LET GP = HW * HR
REM *** Output Routine ***
PRINT " "
PRINT "Name: "; N$, "Rate: "; HR, "Hours: "; HW, "Pay: "; GP
PRINT " "
REM *** Processing Control Test ***
REM test for upper and lowercase
INPUT "Another Calculation (Y/N)"; A$
PRINT " "
IF A$ = "Y" THEN GOTO INPUT.RTN
IF A$ = "y" THEN GOTO INPUT.RTN
END
Save the program on your floppy as A:PROG1.BAS
File -> Save As -> A:PROG1.BAS
Run the program by pressing F5 or by selecting Start under Run.
Enter the following 2 cases to test the program. Running two consecutive tests
will include a test of the control loop.
Name Rate Hours
H. Johnson 4.95 41
B. Grant 6.00 39
Sample Output:
PROG1.BAS Juan Marquez TR 10:30
Enter employee name: H. Johnson
Enter hourly rate: 4.95
Enter hours worked: 41
Name: H. Johnson Rate: 4.95 Hours: 41 Pay: 202.95
Another Calculation (Y/N)? y
Enter employee name: B. Grant
Enter hourly rate: 6
Enter hours worked: 39
Name: B. Grant Rate: 6 Hours: 39 Pay: 234
Another Calculation (Y/N)? n
Press any key to continue
While the output is still displayed on the screen, press the
Alt + Print Screen keys to place a copy of the screen into the clipboard.
Open Microsoft Word, and paste the picture into Word.
Print the Word document to turn in as your sample output.
From QBASIC, print a copy of the source code to turn in: (File > Print)
Sample flowchart:

Revised: 7/30/2000 - www.mc.maricopa.edu/academic/business/cis105/basic/basic3_lab1.html