Question: An additional problem arises when two roads cross. Now one Place object that is at the point of intersection will belong to two Road objects.
An additional problem arises when two roads cross. Now one Place object that is at the point of
intersection will belong to two Road objects. Because in C we need to do our own garbage
collection, writing a destructor for this linked list requires the use of a reference count. We can
only delete Place objects that are not parts of any other Road object.
The TrafficLight object has several interesting features. First, we need to represent the current
status of the light and define the transitions between the possible states. Our traffic light design
requires that the signal in the two opposite directions northsouth or eastwest are the same at all
times. There are at least two methods for recording the current state and computing the new state
on each timer update. The first method requires that we store the timing data supplied by the user
and every time the light color changes we start a countdown with the appropriate value. The design
works, but the implementation is quite messy.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
