Photo AI
Question 1
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
Step 1
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
Answer
To calculate the introduction time based on the number of participants, follow these steps:
edtParticipants
edit box:
var
numParticipants: Integer;
begin
numParticipants := StrToInt(edtParticipants.Text);
var
minutesPerParticipant: Real;
begin
if numParticipants <= 20 then
minutesPerParticipant := 2.5
else if numParticipants <= 50 then
minutesPerParticipant := 2.3
else
minutesPerParticipant := 2.0;
var
totalMinutes: Real;
begin
totalMinutes := numParticipants * minutesPerParticipant;
edtMinsRounded.Text := FormatFloat('0.00', totalMinutes); // Displays the rounded minutes
end;
Step 3
Answer
To calculate the factorial of a number selected from spnNumber
, use the following steps:
var
selectedNum, factorial: Integer;
begin
selectedNum := spnNumber.Value;
factorial := 1;
for i := 1 to selectedNum do
factorial := factorial * i;
edtFactorial.Text := IntToStr(factorial); // Displays the factorial
end;
Report Improved Results
Recommend to friends
Students Supported
Questions answered