Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Pseudo code Help for a Traffic Light. Please write pseudo code for the following

ID: 3816711 • Letter: P

Question

Pseudo code Help for a Traffic Light. Please write pseudo code for the following situation:

- The traffic light intersection is to be green in the North/South direction for 3 seconds and green in the East/West direction for 2 seconds. In normal operationg conditions all yellow lights are 1 second long.

- Extend the problem for step #1 to include triggered left turn lanes in teh North/south directions of travel. When triggured left turn lights should be on for 1 second.

My pseudo code thus far is: If NOT green AND NOT yellow THEN red.

Thanks.

Explanation / Answer

a=Calculate(1)
b=Calculate(2)
X1=0
X2=0
max=60 sec
IF (a b) THEN
DO
TrafficLight_1(a,b, 1,2)

while(program is running)
ElSE
DO
TrafficLight_1(b,a,2,1)

while(program is running)

TrafficLight_1 FUNCTION:
TrafficLight_1(&n1,&n2, i, j)
{
timer=1
while(n1>OSi and timer !=max )
IF (TRj.GREEN EQUEL True)
TRj.YELLOW=True
TRj.RED=True
TRi.GREEN=True
timer++

IF (n1>0) AND (n2!=0)
TRi.YELLOW=True
TRi.RED=True
timer=1
IF (n2 != 0)
while(n2>OSj and timer !=max)
TRj.GREEN=True
timer++
n1=Calculate(i)
if (n1>0)
IF (TRj.GREEN EQUEL True)
TRj.YELLOW=True
TRj.RED=True

n2=Calculate(j)
}

Calculate FUNCTION:
Calculate(i)
{
n=ISi+(xi-OSi)
Xi=n
Return n
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote