Starting from:

$30

CPT121-Task 1.3.1 Decisions Solved

1.     Write a program which simulates the logic of a traffic light, based on the road rules for traffic light signals as outlined at https://www.vicroads.vic.gov.au/safety-and-road-rules/roadrules/a-to-z-of-road-rules/traffic-controls-at-intersections (basic Traffic lights rules only), and prints the appropriate outcome according to the prevailing conditions (ie. either “stop” or “proceed through intersection”).  

Note that there are multiple factors to take into account when approaching a traffic light and your program should gather information from the user about each of these factors as when / as required and take each of these factors into account, as outlined in the rules for basic Traffic lights noted above.

2.     Consider how you would test the program implemented for question 1 above to ensure that the expected outcome is achieved for each possible combination of factors and test your program accordingly, noting whether the expected outcomes were produced or not.

In any situation where the expected outcome was not produced you should re-examine your code, identify the problem and correct it so that the program produces the correct outcome for that situation.

More products