Photo AI

Complete the code in the given Excursion object class (Excursion/Excursion) as described in QUESTION 2.1.1 to QUESTION 2.1.5 below - NSC Information Technology - Question 2 - 2016 - Paper 1

Question icon

Question 2

Complete-the-code-in-the-given-Excursion-object-class-(Excursion/Excursion)-as-described-in-QUESTION-2.1.1-to-QUESTION-2.1.5-below-NSC Information Technology-Question 2-2016-Paper 1.png

Complete the code in the given Excursion object class (Excursion/Excursion) as described in QUESTION 2.1.1 to QUESTION 2.1.5 below. 2.1.1 Write a mutator method cal... show full transcript

Worked Solution & Example Answer:Complete the code in the given Excursion object class (Excursion/Excursion) as described in QUESTION 2.1.1 to QUESTION 2.1.5 below - NSC Information Technology - Question 2 - 2016 - Paper 1

Step 1

Write a mutator method called setVisitDate

96%

114 rated

Answer

procedure setVisitDate(date: TDateTime);
begin
  visitDate := date;
end;

Step 2

Write a method called requireTourGuide

99%

104 rated

Answer

function requireTourGuide: string;
begin
  if tourGuide then
    Result := 'Yes'
  else
    Result := 'No';
end;

Step 3

Write a method called isConfirmed

96%

101 rated

Answer

function isConfirmed: Boolean;
begin
  Result := (totalLearners <= 600);
end;

Step 4

Write a method called calcAmount

98%

120 rated

Answer

function calcAmount(costPerPerson: Currency): Currency;
var
  numberFree: Integer;
  totalCost: Currency;
begin
  numberFree := groupSize div 10;
  totalCost := (groupSize - numberFree) * costPerPerson;
  Result := totalCost;
end;

Step 5

Complete the toString method

97%

117 rated

Answer

function toString: string;
begin
  Result := 'School name: ' + schoolName + '\n';
  Result := Result + 'Visit date: ' + DateToStr(visitDate) + '\n';
  Result := Result + 'Number of learners: ' + IntToStr(groupSize) + '\n';
  Result := Result + 'Tour guide: ' + requireTourGuide;
end;

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

;