Photo AI

Question 3: PROBLEM-SOLVING PROGRAMMING SCENARIO Information centres, referred to as 'terminals', have been set up at three different points along the routes in the park - NSC Information Technology - Question 3 - 2016 - Paper 1

Question icon

Question 3

Question-3:-PROBLEM-SOLVING-PROGRAMMING--SCENARIO--Information-centres,-referred-to-as-'terminals',-have-been-set-up-at-three-different-points-along-the-routes-in-the-park-NSC Information Technology-Question 3-2016-Paper 1.png

Question 3: PROBLEM-SOLVING PROGRAMMING SCENARIO Information centres, referred to as 'terminals', have been set up at three different points along the routes in th... show full transcript

Worked Solution & Example Answer:Question 3: PROBLEM-SOLVING PROGRAMMING SCENARIO Information centres, referred to as 'terminals', have been set up at three different points along the routes in the park - NSC Information Technology - Question 3 - 2016 - Paper 1

Step 1

Button [3.1 – Activity/Facility codes for all terminals and directions]

96%

114 rated

Answer

To display the content of the two-dimensional array arrArtCodes, follow these steps:

  1. Set Up Column Headings: Begin with displaying the column headings that correspond to the directions (North, South, East, West).

  2. Outer Loop for Rows: Use an outer loop to iterate over the terminals (Terminal 1, Terminal 2, Terminal 3).

  3. Inner Loop for Columns: Within the outer loop, use an inner loop to go through each direction.

  4. Fetch and Display Codes: During each iteration, fetch the corresponding activity code from the arrArtCodes array based on the terminal and direction.

    • For example, to access Terminal 1 to the North, the code would be ‘SH’.
  5. Output Formatting: Join the elements from the arrArtCodes array into a single output line per terminal. Display each on a new line for clarity.

  6. Display Neatly: Ensure outputs are formatted into neat columns for better readability.

Step 2

Button [3.2 – Activities/Facilities from a selected terminal and direction]

99%

104 rated

Answer

To display activities from a selected terminal and direction, implement the following steps:

  1. Display Selected Terminal and Direction: Show the user the chosen terminal number and direction in the output area.

  2. Retrieve Activity Code: Extract the activity codes from the arrCodes by first selecting the terminal and its respective direction.

  3. Loop Through Codes: Loop through the length of the extracted code to access each code in the arrCodes array.

  4. Comparison and Display: For every code compared with the arrCodes, fetch the corresponding activity from arrActivities and display it alongside its code.

  5. Output Activities: Formulate a clear and concise output that lists the activities accessible from that terminal and direction.

Step 3

Button [3.3 – Access routes to selected activity/facility]

96%

101 rated

Answer

To access routes to a selected activity, follow these steps:

  1. Extract Selected Index: Get the index of the selected activity from the combo box.

  2. Initialize Counter: Start a counter at 0 to keep track of the number of access routes.

  3. Display Heading: Show a heading indicating the following information will be related to the selected activity.

  4. Outer Loop for Terminals: Create an outer loop to evaluate each terminal entry within arrArtCodes.

  5. Inner Loop for Directions: Use an inner loop for columns to check each direction whether the selected activity's code exists in the corresponding code within the array.

  6. Display Valid Entries: If the selected activity is part of the terminal's direction codes, display the terminal number and direction, and increment the counter by 1.

  7. Final Count Display: After looping through all entries, display the total routes available based on the counter.

Step 4

Button [3.4 – Maintenance at a selected activity/facility]

98%

120 rated

Answer

To handle maintenance codes for an activity, perform the following actions:

  1. Select Activity from Combo Box: Begin by extracting the index of the selected activity for which maintenance is needed.

  2. Outer Loop for Terminals: Implement an outer loop to process over rows for each terminal’s activity codes.

  3. Check Conditions: Within the loop, verify if the selected activity's code exists in the two-dimensional array to identify relevant terminals.

  4. Update Access Code: Remove the corresponding access code from the arrArtCodes array for the selected activity, making it unavailable due to maintenance.

  5. Display Notification: Output a message indicating that the access routes to the selected activity/facility are closed due to maintenance.

  6. Refresh Display: Adjust the output area to show the updated version of the arrArtCodes array reflecting the removed codes.

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

;