this is a sample code for *simple grading system*

database name: grade

** JGL-GRADINGSYSTEM.PRG copmutes the prelim, midterm, finals, and over-all grades, with additioal background color
** PROGRAM DATE: FEBRUARY 10,2010


activate screen
clear screen
local cSTNO, cAns, nPG, nMG, nFG, nOG
local nAquiz, nCS, nPE, nME, nFE
cSTNO=space(4)
cAns=”N”
nPG=0
nMG=0
nFG=0
nOG=0
nAquiz=0
nCS=0
nPE=0
nME=0
nFE=0

clear
use grade
go top
do while .t.
cSTNO=space(4)
nPG=0
nMG=0
nFG=0
nOG=0
nAquiz=0
nCS=0
nPE=0
nME=0
nFE=0
set color to R/W
@2,5 say “Enter student number:” get cSTNO
read
use grade
locate for (grade->stno)=cSTNO
if .not. found()
? chr(7) && to ring the bell
set color to R/W
@8,5 say “That student number does not exist!”
wait
clear
loop
else
@3,10 say grade->NAME
endif
set color to B/W
@6,12 say “INPUT PRELIM DATA:”
set color to  G/W
@8,5 say “Average quiz:” get nAquiz
set color to  G/W
@9,5 say “Class Standing:” get nCS
set color to G/W
@10,5 say “Prelim Exam:” get nPE
read
set color to B/W
nPG= (nAquiz*0.30)+(nCS*0.30)+(nPE*0.40)
@11,7 say “PRELIM GRADE:”
@11,30 say nPG
nAquiz=0
nCS=0
set color to B/W
@13,12 say “INPUT MIDTERM DATA:”
set color to  G/W
@15,5 say “Average quiz:” get nAquiz
set color to  G/W
@16,5 say “Class Standing:” get nCS
set color to G/W
@17,5 say “Midterm Exam:” get nME
read
set color to B/W
nMG= (nAquiz*0.30)+(nCS*0.30)+(nME*0.40)
@18,7 say “MIDTERM GRADE:”
@18,30 say nMG
nAquiz=0
nCS=0
set color to B/W
@20,12 say “INPUT FINALS DATA:”
set color to  G/W
@22,5 say “Average quiz:” get nAquiz
set color to  G/W
@23,5 say “Class Standing:” get nCS
set color to G/W
@24,5 say “Final Exam:” get nFE
read
set color to B/W
nFG= (nAquiz*0.30)+(nCS*0.30)+(nFE*0.40)
@25,7 say “FINAL GRADE:”
@25,30 say nFG
nOG=(nPG*0.30)+(nMG*0.30)+(nFG*0.40)
set color to B/W
@27,7 say “Your Grade:”
@27,30 say nOG
set color to G/W
@30,8 say “Remark:”
if nOG>=75
set color to B/W
@30,20 say “PASS!”
else
set color to R/W
@30,20 say “FAIL!”
endif
set color to B/W
@31,1
wait “Compute another? (Y/N)” to cAns
if upper(cAns)=”Y”
replace PG with nPG, MG with nMG, ;
FG with nFG, OG with nOG
clear
loop
else
replace PG with nPG, MG with nMG, ;
FG with nFG, OG with nOG
exit
endif
enddo
close databases
return