Photo AI

VRAAG 4: PROBLEEMOPLOSSINGSPROGRAMMERING Stappers gebruik 'n afstandskaart om hulle staproetes te beplan - NSC Information Technology - Question 4 - 2021 - Paper 1

Question icon

Question 4

VRAAG-4:-PROBLEEMOPLOSSINGSPROGRAMMERING--Stappers-gebruik-'n-afstandskaart-om-hulle-staproetes-te-beplan-NSC Information Technology-Question 4-2021-Paper 1.png

VRAAG 4: PROBLEEMOPLOSSINGSPROGRAMMERING Stappers gebruik 'n afstandskaart om hulle staproetes te beplan. Kontrolepunte versus rasplike of omgeplakte op 'n staproet... show full transcript

Worked Solution & Example Answer:VRAAG 4: PROBLEEMOPLOSSINGSPROGRAMMERING Stappers gebruik 'n afstandskaart om hulle staproetes te beplan - NSC Information Technology - Question 4 - 2021 - Paper 1

Step 1

Knoppie [4.1 - Vertoon afstandskaart]

96%

114 rated

Answer

To display the distance map:

  1. Initialize an index variable to loop through the arrName array, which contains the control points.
  2. Print the title/header for the distance chart.
  3. Iterate through the arrName array and print each control point name.
  4. For each corresponding distance in the arrAfstande array, iterate through the column indexes; print the distance values with proper formatting.
  5. Ensure the distances are represented in kilometers with two decimal places for clarity.

Example Output:

Morgan  Haga Haga  Cintsa  Beacon  Gonubie
0.00   62.00     13.00  24.63  16.20
62.00  0.00      61.00  59.87  26.00
13.00  61.00     0.00   66.62  24.63
24.63  59.87     66.62  0.00   15.20
16.20  26.00     24.63  15.20  0.00

Step 2

Knoppie [4.2 - Validering]

99%

104 rated

Answer

To validate the distance values:

  1. Loop through all distance values in the arrAfstande array.
  2. For each value, check if it corresponds accurately to its symmetrical position (i.e., arrAfstande[iRow][iCol] should equal arrAfstande[iCol][iRow]).
  3. If a mismatch is detected, replace the value with the correct distance.
  4. Build a string representation for output that shows both indices and their accurate distances.

Example Output:

Vervang die afstand by:
Byv: 1,1 met 9.57
Byv: 2,3 met 15.2

Step 3

Knoppie [4.3 - Roetebepalner]

96%

101 rated

Answer

To select and display the route:

  1. Initialize a variable to hold selected route choices from a combo box.
  2. Extract the selected route from the combo box, initializing the total distance variable to zero.
  3. Loop through the selected route, and for each segment of the route, retrieve the corresponding distances from the arrAfstande array.
  4. Update the total distance by adding the individual segments' distances.
  5. Format and output the details of each segment along with the total distance for clarity.

Example Output:

Roete: 4,3,1,2,5
Beacon na Cintsa: 9.63 (192.6 minute)
Totale afstand: 38.3 km

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

;