CIS105 - Programming Module
Lab Assignment 3 (turn in source code, sample output, and a structure chart) - Points: _____
The objective of this assignment is to rewrite the program created in assignment 2 as a modular program.
The input data is list of employees with pay rates and hours worked that must be used to calculate
the net pay. An example of a similar program is attached as a reference.
Programming Environment: MS DOS QBASIC
Start > Classes > Structured Classes > CIS105 > QBASIC
Press ESCape to enter the editor
Enter the program you develop and save it on your floppy as A:PROG3.BAS.
File -> Save As -> A:PROG3.BAS
Run the program by pressing F5 or by selecting Start under Run.
Use the Alt + Print Screen keys to capture a copy of the screen, and then
paste it into a Word document for printing.
This document is the sample output that needs to be turned in.
From QBASIC, print a copy of the source code to turn in:
File > Print
Required Formulas:
IF hours > 40 THEN
gross = ((hours - 40) * rate * 1.5) + (rate * 40)
ELSE
gross = rate * hours
END IF
fed.tax = gross * .14
net.pay = gross - fed.tax
Required Input Data:
Name Rate Hours
H. Johnson 4.95 41
B. Grant 6.00 39
R. Thomas 2.25 45
J. Lopez 5.54 36
M. Smith 8.95 37
EOF 9.99 99
Required Output Report:
PROG3.BAS Payroll Report by Juan Marquez 11-18-1999
Name Rate Hours Tax Netpay
H. Johnson 4.95 41 28.7595 176.6655
B. Grant 6 39 32.76 201.24
R. Thomas 2.25 45 14.9625 91.9125
J. Lopez 5.54 36 27.9216 171.5184
M. Smith 8.95 37 46.361 284.789
Total Pay 926.1254
Press Alt & Print Screen keys to capture the screen, and
then press Enter to continue:
Assignment #3 Sample Source Code:
REM PROG3.BAS (your name and class time goes here)
REM Modular program to create a Sales Report of action figures sold
REM Total Numeric Total Sales Price Numeric Cost of item
REM Item$ String Item Description Qty Numeric Quantity ordered
REM Cost Numeric Qty x Price Tax Numeric 6% of Cost
REM Order Numeric Total amount of order (Cost + Tax)
REM *** Main Routine
GOSUB INIT.RTN
GOSUB INPUT.RTN
GOSUB PROCESS.RTN
GOSUB TOTAL.RTN
GOTO EOP
PROCESS.RTN:
DO WHILE Item$ <> "EOF"
GOSUB CALCULATE.RTN
GOSUB OUTPUT.RTN
GOSUB INPUT.RTN
LOOP
RETURN
INIT.RTN:
REM *** Initialize Routine ***
LET Total = 0
CLS
PRINT "PROG3.BAS Sales Report by Juan Marquez", DATE$
PRINT " "
PRINT "Item", "Price", "Qty", "Tax", "Order Amt"
PRINT " "
RETURN
INPUT.RTN:
REM *** Input Routine ***
READ Item$, Price, Qty
RETURN
CALCULATE.RTN:
REM *** Processing Routine ***
REM *** 5% markup when Qty <= 40
IF Qty > 40 THEN
LET Cost = Price * Qty
ELSE
LET Cost = Price * Qty * 1.05
END IF
LET Tax = Cost * .06
LET Order = Cost + Tax
LET Total = Total + Order
RETURN
OUTPUT.RTN:
REM *** Output Routine ***
PRINT Item$, Price, Qty, Tax, Order
RETURN
TOTAL.RTN:
REM *** Print Totals ***
PRINT " "
PRINT "Total Sales", " ", " ", " ", Total
PRINT " "
PRINT "Press Alt & Print Screen to capture the screen, and "
INPUT "then press Enter to continue: ", P
RETURN
EOP:
DATA "H. Johnson", 4.95, 41
DATA "B. Grant", 6.00, 39
DATA "R. Thomas", 2.25, 45
DATA "J. Lopez", 5.54, 36
DATA "M. Smith", 8.95, 37
DATA "EOF",9,99
END
Assignment #3 Sample Output:
PROG3.BAS Sales Report by Juan Marquez 03-31-2000
Item Price Qty Tax Order Amt
H. Johnson 4.95 41 12.177 215.127
B. Grant 6 39 14.742 260.442
R. Thomas 2.25 45 6.075 107.325
J. Lopez 5.54 36 12.56472 221.9767
M. Smith 8.95 37 20.86245 368.5699
Total Sales 1173.441
Press Alt & Print Screen to capture the screen, and
then press Enter to continue:
Assignment #3 Sample Structure Chart:

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