program ukabremark {program in development for the remarking of marks}; uses wincrt; type {USER DEFINED TYPES} core = record id_count : integer; marks : string; studs : string; name : string; firstrun : boolean; end; studentstruc = record id_num : integer; first_name : string [10]; second_name : string [10]; cand_number : string [5]; centre_number : string [5]; sub_ref_code : string [5]; orig_mark : string; orig_grade : string; re_mark : string; re_grade : string; scriptreq : string; gradechange : boolean; end; markscheme = record sub_num : array [1..6] of integer; sub_ref : string [5]; grade_a : string[3]; grade_b : string [3]; grade_c : string [3]; grade_d : string [3]; grade_e : string [3]; end; bufferarray = array [1..12,1..12] of string [10]; var {GLOBAL VARIABLES} studinfo : file of studentstruc; individinfo : studentstruc; marksfile : file of markscheme; subjects : markscheme; premenuselect : integer; menuselect : integer; tempgrade : char; start:char; corefile : file of core; coreinfo : core; firstrun : string; function strtoint(x : string) : longint; {CHANGES STRING VARIABLES TO INTEGERS} var e : integer; i : longint; begin val(x,i,e); strtoint := i; end; procedure startup; {MAIN MENU} var auth:char; begin; assign (corefile, 'core.bob'); reset (corefile); repeat read (corefile,coreinfo); until eof (corefile); writeln ('##**--Welcome To The UKAB Remarking Program--**##'); writeln (''); writeln ('Please Choose One Of The Following Choices To Continue'); writeln (''); writeln ('1: Input The Candidates Details'); writeln ('2: Input The Candidates NEW Mark'); writeln ('3: Search The Candidates Details'); writeln ('4: Change The Grade Boundaries'); writeln ('5: View The Current Grade Boundaries'); writeln ('6: List Of Remarks Where Grades Have Changed'); writeln ('7: List Of Remarks Outstanding (Not Completed)'); writeln ('8: Search For A List Of Remarks In A Particular Subject'); writeln ('9: Search For A List Of Remarks From A Particular Centre'); writeln ('10: Change The File Paths'); writeln ('11: Quit Program'); writeln (''); writeln ('Current Students File Path := ', coreinfo.studs,''); writeln ('Current Marks File Path := ', coreinfo.marks,''); writeln (''); writeln ('Your Choice Is ... '' '); readln (menuselect); while menuselect > 11 do {VALIDATION CHECK} begin writeln ('ERROR: An Invalid Value Has Been Entered, Please Choose Again'); writeln (''); writeln ('Your Choice Is ...'); readln (menuselect); end; {while} while menuselect <1 do begin writeln ('ERROR: An Invalid Value Has Been Entered, Please Choose Again'); writeln (''); writeln ('Your Choice Is ...'); readln (menuselect); end;{while} clrscr; end;{procedure} procedure premenu; {SETUP MENU} var auth:char; begin writeln ('##**--Welcome To The UKAB Remarking Program--**##'); writeln (''); writeln (' ##**-- Program Setup --**##'); writeln ('Please Choose One Of The Following Choices To Continue'); writeln (''); writeln ('1: Main Menu'); writeln ('2: Sign In Under Different Name'); writeln ('3: Set Directory Paths (If Not Previously Set)'); writeln (''); writeln ('Your Choice is... '); readln (premenuselect); clrscr; end; procedure option_10; {PROCEDURE FOR CHANGING THE FILE PATHS} var tempbuffer : string; tempbuffer2 : string; tempbuffer3 : string; begin writeln ('##**--Welcome To The UKAB Remarking Program--**##'); writeln (''); assign (corefile, 'core.bob'); rewrite (corefile); with coreinfo do writeln ('Please Enter The Path Address For The Data File (Students) '); readln (tempbuffer2); coreinfo.studs := tempbuffer2; writeln ('Please Enter The Path Address For The Data File (Marks) '); readln (tempbuffer3); coreinfo.marks := tempbuffer3; write (corefile, coreinfo); close (corefile); start := 'y'; clrscr end; function remark (num,grade:string):string; {FUNCTION FOR THE CALCULATION OF RE-MARKS} begin assign (marksfile, 'marks.bob'); reset (marksfile); repeat read (marksfile,subjects); if strtoint(grade) = strtoint(subjects.sub_ref) then if strtoint (num) >= strtoint(subjects.grade_a) then remark := 'A' else if strtoint(num) >= strtoint(subjects.grade_b) then remark := 'B' else if strtoint(num) >= strtoint (subjects.grade_c) then remark := 'C' else if strtoint(num) >= strtoint (subjects.grade_d) then remark := 'D' else if strtoint(num) >= strtoint (subjects.grade_e) then remark := 'E' else if strtoint(num) < strtoint (subjects.grade_e) then remark := 'U' until eof; end; procedure option_1; {PROCEDURE FOR INPUTTING CANDIDATES DETAILS} var auth : char; stop : char; cands: integer; total : integer; begin reset (corefile); if coreinfo.firstrun <> True then begin assign (studinfo, 'studs.bob'); rewrite (studinfo); end else assign (studinfo,'studs.bob'); reset (studinfo); seek (studinfo,coreinfo.id_count); rewrite (corefile); with individinfo do begin clrscr; writeln ('How many people would you like to add? '); readln (cands); total := coreinfo.id_count + cands; while coreinfo.id_count < total do begin auth:= 'n'; while auth = 'n' do begin individinfo.id_num := coreinfo.id_count; clrscr; writeln ('Please Enter Id ',coreinfo.id_count, 's First Name '); readln (first_name); writeln ('Please Enter Id ',coreinfo.id_count, 's Surname '); readln (second_name); writeln ('Please Enter Id ',coreinfo.id_count, 's Candidate Number '); readln (cand_number); writeln ('Please Enter Id ',coreinfo.id_count, 's Centre Number '); readln (centre_number); writeln ('Please Enter Id ',coreinfo.id_count, 's Subject Reference Code '); readln (sub_ref_code); writeln ('Please Enter Id ',coreinfo.id_count, 's Original Mark '); readln (orig_mark); writeln ('Please Enter Id ',coreinfo.id_count, 's NEW Mark (if any) '); readln (re_mark); writeln ('Does The Centre Wish For The Script To Be Returned? '); readln (scriptreq); writeln ('Are You Sure All Of This Data Is Correct? Y or N '); readln (auth); coreinfo.id_count := (coreinfo.id_count)+1; coreinfo.firstrun := True; end; end; clrscr; write (studinfo,individinfo); write (corefile,coreinfo); end; close (studinfo); close (corefile); start := 'y' end; procedure option_2; {PROCEDURE FOR INPUTTING THE CANDIDATES RE-MARK AND GETTING A GRADE} var auth : char; entry, entry2 : string; candnum : integer; found : boolean; ary1 : bufferarray; buffer, buffer2 : studentstruc; count : integer; begin clrscr; assign (corefile, 'core.bob'); reset (corefile); assign (studinfo, 'studs.bob'); reset (studinfo); writeln ('Please Enter The Candidate Number '); readln (entry); writeln ('Please Enter The Centre Number '); readln (entry2); repeat read (studinfo,individinfo); if (individinfo.cand_number = entry) AND (individinfo.centre_number = entry2) then begin if strtoint(individinfo.re_mark) >1 then begin individinfo.re_grade := remark (individinfo.re_mark,individinfo.sub_ref_code); end else writeln ('Please Enter A Re-Mark Grade For Candidate #',coreinfo.id_count,''); readln (individinfo.re_mark); individinfo.re_grade := remark (individinfo.re_mark,individinfo.sub_ref_code) end; individinfo.orig_grade := remark(individinfo.orig_mark , individinfo.sub_ref_code); if individinfo.re_grade = individinfo.orig_grade then begin individinfo.gradechange := True; end; until eof (studinfo); write (studinfo,individinfo); close (studinfo); close (corefile); end; procedure option_3; {PROCEDURE FOR SEARCHING CANDIDATES BY CANDIDATE NUMBER} var auth : char; entry, entry2, entry3 : string; candnum : integer; found : boolean; ary1 : bufferarray; buffer, buffer2 : studentstruc; count : integer; begin clrscr; assign (corefile, 'core.bob'); reset (corefile); assign (studinfo, 'studs.bob'); reset (studinfo); writeln ('Please Enter The Candidate Number '); readln (entry); writeln ('Please Enter The Centre Number '); readln (entry2); repeat read (studinfo,individinfo); if (individinfo.cand_number = entry) AND (individinfo.centre_number = entry2) then begin clrscr; writeln ('ID Number:: ',individinfo.id_num ,''); writeln ('First Name:: ',individinfo.first_name, ''); writeln ('Surname:: ',individinfo.second_name,''); writeln ('Candidate Number:: ',individinfo.cand_number, ''); writeln ('Centre Number:: ',individinfo.centre_number,''); writeln ('Subject Reference Code:: ',individinfo.sub_ref_code,''); writeln ('Original Mark:: ',individinfo.orig_mark, ''); writeln ('Original Grade:: ',individinfo.orig_grade,''); writeln ('New Mark:: ',individinfo.re_mark, ''); writeln ('Script Need Returning?:: ',individinfo.scriptreq,''); end; until eof (studinfo); close (studinfo); close (corefile); writeln (''); writeln (''); writeln ('Press Enter To Get Back To Menu '); readln (entry3); if entry3 <> 'yes' then begin start := 'y'; end; clrscr; end; procedure option_4; {PROCEDURE FOR CHANGING MARKSCHEME} var auth: char; count : integer; begin; assign (marksfile, 'marks.bob'); rewrite (marksfile); with subjects do begin for count:= 1 to 5 do begin auth:= 'n'; while auth = 'n' do begin writeln ('Please Enter The Relevant Subject Code '); readln (sub_ref); writeln ('Please Enter The Mark Required For An *A* Grade '); readln (grade_a); writeln ('Please Enter The Mark Required For A *B* Grade '); readln (grade_b); writeln ('Please Enter The Mark Required For A *C* Grade '); readln (grade_c); writeln ('Please Enter The Mark Required For A *D* Grade '); readln (grade_d); writeln ('Please Enter The Mark Required For An *E* Grade '); readln (grade_e); writeln ('Are You Sure All Of This Data Is Correct? y or n '); readln (auth); write (marksfile,subjects); clrscr; end; end; end; close (marksfile); start:= 'y' end; procedure option_5; {PROCEDURE FOR VIEWING THE GRADE BOUNDARIES} var entry : string; auth : char; count : integer; begin assign (marksfile, 'marks.bob'); auth := 'y'; while auth = 'y' do begin reset (marksfile); writeln ('Please Enter The Subject Reference Code '); readln (entry); repeat read (marksfile,subjects); if entry = subjects.sub_ref then begin writeln ('For Ref Code ',subjects.sub_ref,''); writeln ('Grade A : ',subjects.grade_a,''); writeln ('Grade B : ',subjects.grade_b,''); writeln ('Grade C : ',subjects.grade_c,''); writeln ('Grade D : ',subjects.grade_d,''); writeln ('Grade E : ',subjects.grade_e,''); writeln (''); end until eof (marksfile); if entry = subjects.sub_ref then begin writeln ('Do You Want To See A Different Subjects Boundaries? y or n '); readln (auth); end else writeln ('Incorrect Reference Code Inputted, Press Enter To Try Again'); readln; auth := 'y'; close (marksfile); clrscr; end; start := 'y'; clrscr; end; procedure endeth; {FINISHING SCREEN PROCEDURE} begin; writeln ('Thank-You For Using William Burtons UKAB Re-Marking Facilitating Program.'); writeln (''); writeln ('Any Queries To burtons-r-us@ntlworld.com'); writeln (''); writeln ('© Copyright. William Burton 2003.'); writeln (''); writeln ('This Program May NOT Be Used Without Prior Permission From The Author.'); end; procedure menuselector; {MAIN MENU FORWARDER} begin; start:= 'n'; If menuselect = 1 then option_1 else If menuselect = 2 then option_2 else If menuselect = 3 then option_3 else If menuselect = 4 then option_4 else If menuselect = 5 then option_5 else {if menuselect = 6 then else} {if menuselect = 7 then else} {if menuselect = 8 then else} {If menuselect = 9 then else} If menuselect = 10 then option_10 else If menuselect = 11 then endeth else end; procedure premenuselector; {SETUP MENU FORWARDER} begin; {if premenuselect = 2 then else} if premenuselect = 3 then option_10 else menuselector; end; begin {MAIN PROGRAM} premenu; premenuselector; if premenuselect = 1 then begin startup; menuselector; while start = 'y' do begin; startup; menuselector; end; end; end.