Photo AI

SECTION A QUESTION 1: GENERAL PROGRAMMING SKILLS Do the following: - Open the incomplete program in the Question 1 folder - NSC Information Technology - Question 1 - 2019 - Paper 1

Question icon

Question 1

SECTION-A--QUESTION-1:-GENERAL-PROGRAMMING-SKILLS--Do-the-following:----Open-the-incomplete-program-in-the-Question-1-folder-NSC Information Technology-Question 1-2019-Paper 1.png

SECTION A QUESTION 1: GENERAL PROGRAMMING SKILLS Do the following: - Open the incomplete program in the Question 1 folder. - Enter your examination number as a co... show full transcript

Worked Solution & Example Answer:SECTION A QUESTION 1: GENERAL PROGRAMMING SKILLS Do the following: - Open the incomplete program in the Question 1 folder - NSC Information Technology - Question 1 - 2019 - Paper 1

Step 1

Button [1.1 - Random number]

96%

114 rated

Answer

To generate a random number in the range of 100 to 120, you can use a random number generator function. Here's an example code snippet:

var
  randomNum: Integer;
begin
  randomNum := Random(21) + 100; // Generates a number between 100 and 120
  edtRandomNumber.Text := IntToStr(randomNum); // Displays the random number
end;

Step 2

Button [1.2 - Calculate minutes]

99%

104 rated

Answer

To calculate the introduction time based on the number of participants, follow these steps:

  1. Extract the number of participants from the edtParticipants edit box:
    var
      numParticipants: Integer;
    begin
      numParticipants := StrToInt(edtParticipants.Text);
    
  2. Determine the minutes per participant based on the criteria:
    var
      minutesPerParticipant: Real;
    begin
      if numParticipants <= 20 then
        minutesPerParticipant := 2.5
      else if numParticipants <= 50 then
        minutesPerParticipant := 2.3
      else
        minutesPerParticipant := 2.0;
    
  3. Calculate total minutes and display:
    var
      totalMinutes: Real;
    begin
      totalMinutes := numParticipants * minutesPerParticipant;
      edtMinsRounded.Text := FormatFloat('0.00', totalMinutes); // Displays the rounded minutes
    end;
    

Step 3

Button [1.3 - Calculate factorial]

96%

101 rated

Answer

To calculate the factorial of a number selected from spnNumber, use the following steps:

  1. Extract the selected number:
    var
      selectedNum, factorial: Integer;
    begin
      selectedNum := spnNumber.Value;
    
  2. Calculate the factorial using a loop:
    factorial := 1;
    for i := 1 to selectedNum do
      factorial := factorial * i;
    
  3. Display the result:
    edtFactorial.Text := IntToStr(factorial); // Displays the factorial
    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

;