* ONEGRADE.CMD

store F to mdone
store " " to mchoice
do while .not. mdone
    set confirm on
    erase
    text

     This function allows you to print out just one grade for all the
students.  Choose from below as to whether you want to have a TEST,
PROJECT or ASSIGNMENT, then give the number of your choice.  The
students' grades can be printed in DESCENDING or ALPHABETICAL order.

            1.  Print Out a Test
            2.  Print Out a Project
            3.  Print Out an Assignment
            4.  Return to the Print Menu

    endtext

    store "  " to mnum
    store F to mfin
    do while .not. mfin
        @ 12,15 say "Your Choice? ---> " get mchoice pict "#"
        read
        if val(mchoice) > 4 .or. val(mchoice) < 1
            loop
        endif
        if mchoice = "1"
            do while val(mnum) < 1 .or. val(mnum) > 5
                @ 14,15 say "Which Test? ---> " get mnum
                read
            enddo
            store "TEST0" + mnum to mfield
        endif
        if mchoice = "2"
            do while val(mnum) < 1 .or. val(mnum) > 5
                @ 14,15 say "Which Project? ---> " get mnum
                read
            enddo
            store "PROJ0" + mnum to mfield
        endif
        if mchoice = "3"
            do while val(mnum) < 1 .or. val(mnum) > 15
                @ 14,15 say "Which Assignment? ---> " get mnum
                read
            enddo
            if val(mnum) < 10
                store "ASN0" + mnum to mfield
            else
                store "ASN" + mnum to mfield
            endif
        endif
        if mchoice = "4"
            store T to mdone
            store T to mfin
            release all like m*
            release all like n*
            return
        endif

        * SET UP PRINT OUT PARAMETERS

        erase
        store t to make
        store " " to mmake
        do while make
          @ 12,15 say "<A>lphabetical or <D>escending Grade Order? " get mmake
          @ 13,15 say "            Type A or D  "
          read
          if !(mmake) = "A"
            erase
            @ 12,25 say "SORTING INFORMATION"
            sort on NAME to temp
          else
            if !(mmake) = "D"
              erase
              @ 12,25 say "SORTING INFORMATION"
              sort on &mfield to temp descending
            else
              loop
            endif
          endif
          store f to make
        enddo
        use temp
        goto top
        @ 12,25 SAY "PRINTING INFORMATION"
        set console off
        set print on

        * BEGIN PRINT OUT

        ?
        ?
        ? GSCHOOL + "                    "
        ?? "Class: "
        ?? GCLASS
        ? "Period: " + FILE2
        ? "Assignment: " + mfield
        store 0 to msum
        store 0 to mstudent
        ?
        do while .not. eof
            ? "          "
            ?? NAME
            if &mfield = 999.00
                ?? "     NM"
            else
                ?? &mfield
                store msum + &mfield to msum
                store mstudent + 1 to mstudent
            endif
            skip
        enddo
        store msum/mstudent to mcav
        ?
        ?
        ? "                  Class Average:  "
        ?? mcav
        eject
        set print off
        set console on
        store T to mfin
        use &FILE
    enddo
enddo


    if &mfield = 999.00
                ?? "     NM"
            else
    