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 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 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
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To display the activity/facility codes for all terminals and directions, the program needs to:
Display Column Headings: Show the directions (North, South, East, West) as the column headers.
Loop through Rows: Use an outer loop to iterate over each terminal and its number.
Inner Loop: Use an inner loop to go through the columns for the directions.
Display Data: For each terminal, extract the relevant data from the two-dimensional array arrACodes and display it. The output should look organized, ensuring each entry is on a new line.
End the Output Neatly: Make sure to display the lines in the output area in a clear and readable format.
Step 2
Button [3.2] – Activities/Facilities from a selected terminal and direction]
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The steps to extract and display activities from a selected terminal and direction are as follows:
Display Terminal Number and Direction: First, display the selected terminal number and the chosen direction in the output area.
Extract Code: Retrieve the activity code from the arrCodes corresponding to the selected terminal and direction.
Loop through Codes: Iterate through the arrCodes array to find the relevant activities by comparing each letter in the code.
Display Activities: Show all activities that correspond to the selected terminal and direction in the output.
Step 3
Button [3.3] – Access routes to selected activity/facility]
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To access routes for the selected activity/facility, follow these steps:
Extract Index: Get the index of the selected activity/facility from the combo box.
Initialize Counter: Set a counter to zero to count the number of access routes.
Display Heading: Show a heading in the output area indicating access routes.
Outer Loop for Rows: Loop through each entry in the rows of the two-dimensional array, checking for matches with the selected activity code.
Inner Loop for Columns: For each match, display the corresponding terminal number and direction, incrementing the counter each time a valid route is found.
Display Total Routes: Display the total number of access routes found.
Step 4
Button [3.4] – Maintenance at a selected activity/facility]
98%
120 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To handle maintenance information for selected activities/facilities:
Extract Activity Index: Get the index of the selected activity from the combo box.
Loop through Rows: Iterate through the rows of the arrACodes array.
Check for Activity: Check if the selected activity code exists within the data. If it does, remove the corresponding character from the arrACodes array.
Display Maintenance Message: Inform the user with a message indicating the access routes to the selected activity/facility are closed due to maintenance.
Update Output Area: Finally, refresh the display to show the updated arrACodes array, reflecting the changes made.