Quote:
I tried pasting the two parts together in a number of different ways but nothing worked.
Why on Earth would you assume that?
Would you assume that if you glued half a Ford Transit to half a Bugatti Veyron you'd get a van that did 250 mph, could carry 2 ton of bricks, and got 50mpg?
You've taken two very different pieces of code that happen to use the same language (the fast pedal is on the right, the slow one iis next to it) and some of the same names - then glued them together and hoped that will pass as "doing your homework". When it doesn't work, instead of thinking "what did I do wrong" you've come here and asked us.
Well, I'll tell you: you are glueing two halves of unrelated vehicles together. That may work occasionally, but will fail nearly every time ...
Throw the whole load away, read your homework question again, and try to work out how to solve it properly - it'll be a lot quicker, easier, and simpler in the long run, and will produce better code, which probably means a better grade ...