unit uCandidate;

interface
uses SysUtils;

//Q2.1 - 3
//Class header correct
type TCandidate = class
  //properties private
  //typed and typed correctly

  private
    studentID : string;
    name : string;
    year : integer;
  public
    constructor Create(inSID : string; inNE:string; inYR:integer);
    function getStudentID() :string;
    function getName() : string;
    function getYear() : integer;
    function toString() : string;
end;

implementation

{ TCandidate }
//Q2.2  - 3
//header correct
//correct parameter names and types
constructor TCandidate.Create(inSID: string; inNE: string; inYR: integer);
begin
  //properties assigned correctly
  studentID := inSID;
  name := inNE;
  year := inYR;
end;

// Q2.3 - 2
//Correct header and return types for all three gettters
function TCandidate.getName: string;
begin
  Result := name;
end;

function TCandidate.getStudentID: string;
begin
  Result := studentID;
end;

function TCandidate.getYear: integer;
begin
  Result := year;
end;

// Q2.4  - 4
//header correct
function TCandidate.toString: string;
begin
  //includes all fields
  //fields in correct format
  //returned correctly
  Result :=  name + ' [' + studentID + '] - ' + IntToStr(year) ;
end;

end.
