' DYNAMIC.BAS
' This program reads information into three dynamic arrays and prints it.

OPTION BASE 1                  ' set base of all arrays to 1

CLS

INPUT "How many salesperson names would you like to enter?  ", persons%

IF (persons% > 0) THEN         ' must be at least one salesperson
   
    DIM salesGroup$(persons%)  ' dimension salesGroup$ string array
    DIM bikesSold%(persons%)   ' dimension bikesSold% integer array
    DIM totalSales!(persons%)  ' dimension totalSales! floating-pt. array

    PRINT

    FOR i% = 1 TO persons%     ' get salesperson name and sales data
        INPUT "Enter salesperson name:  ", salesGroup$(i%)
        INPUT "   Bikes sold:  ", bikesSold%(i%)
        INPUT "   Total sales:  $", totalSales!(i%)
        PRINT
    NEXT i%

    PRINT "You entered the following sales data:"
    PRINT
    PRINT "Salesperson     Bikes sold     Total sales"
    PRINT "------------------------------------------"
    PRINT

    ' initialize tmp$, a formatting template for PRINT USING
    tmp$ = "\               \ ###          $$####.##"

    FOR i% = 1 TO persons%     ' print contents of each array
    PRINT USING tmp$; salesGroup$(i%); bikesSold%(i%); totalSales!(i%)
    NEXT i%

END IF

