Photo AI

Star Nursery invites learners from the local schools to a voluntary training programme as part of a community initiative - NSC Information Technology - Question 3 - 2019 - Paper 1

Question icon

Question 3

Star-Nursery-invites-learners-from-the-local-schools-to-a-voluntary-training-programme-as-part-of-a-community-initiative-NSC Information Technology-Question 3-2019-Paper 1.png

Star Nursery invites learners from the local schools to a voluntary training programme as part of a community initiative. Learners who are used as trainees must atte... show full transcript

Worked Solution & Example Answer:Star Nursery invites learners from the local schools to a voluntary training programme as part of a community initiative - NSC Information Technology - Question 3 - 2019 - Paper 1

Step 1

3.1.1(a) Write code for a method called updateHours that receives a value as a parameter. Increase the hours attribute using the received parameter value.

96%

114 rated

Answer

procedure Trainee.updateHours(parameterValue: Integer);
begin
  Hours := Hours + parameterValue;
end;

Step 2

3.1.1(b) Write code for a method called updateSales that receives a received parameter value.

99%

104 rated

Answer

procedure Trainee.updateSales(parameterValue: Real);
begin
  Sales := Sales + parameterValue;
end;

Step 3

3.1.1(c) Write code for a method called updateSales that receives a value as a parameter. Increase the sales attribute using the received parameter value.

96%

101 rated

Answer

procedure Trainee.updateSales(parameterValue: Real);
begin
  Sales := Sales + parameterValue;
end;

Step 4

3.1.2 Write code for a method called qualifiesForBonus. The method must return a Boolean value TRUE if the trainee qualifies for a bonus or FALSE if the trainee does not qualify for a bonus.

98%

120 rated

Answer

function Trainee.qualifiesForBonus: Boolean;
begin
  if (Hours >= 15) and (Sales >= 1200) then
    Result := True
  else
    Result := False;
end;

Step 5

3.1.3 Write code to complete the provided toString method to return a string in the following format.

97%

117 rated

Answer

function Trainee.toString: String;
begin
  Result := Format('%s (%d) attended %.2f hours of training and sold plants to the value of R %.2f',
            [Name, TraineeID, Hours, Sales]);
end;

Step 6

3.2.1 Button [3.2.1 - Click to continue] Write code to do the following.

97%

121 rated

Answer

objTrainee := Trainee.Create(sName, iTraineeID);
btnQ3_2.Visible := True;

Step 7

3.2.2 Button [3.2.2 - Process logbook data] Write code to do the following.

96%

114 rated

Answer

var
  found: Boolean;
begin
  found := False;
  if not FileExists('Logbook.txt') then
    ShowMessage('File does not exist.')
  else
  begin
    AssignFile(LogFile, 'Logbook.txt');
    Reset(LogFile);
    while not Eof(LogFile) do
    begin
      ReadLn(LogFile, line);
      // Process line here
    end;
    CloseFile(LogFile);
  end;
end;

Step 8

3.2.3 Button [3.2.3 - Qualify for a bonus?] Write code to do the following.

99%

104 rated

Answer

if objTrainee.qualifiesForBonus then
  ShowMessage('The trainee qualifies for a bonus.')
else
  ShowMessage('The trainee does not qualify for a bonus.');

Join the NSC students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

;