-
Help!
Here is a brief description of the program I'm trying to write. Its a toll simulation.
I have 3 toll stations with each toll station having different processing times (lets say toll1 = 2s, toll2 = 3s and toll3 = 4s). The input is a number of cars (lets say 100) passing through these 3 tolls and the output was supposed to be the number of cars going through each toll station.
Any ideas on doing this using vector? Thanks in advance.
-
Why a vector? Isn't that just a linear equation?
Assuming 12 seconds pass. In this time t1 has handled 6 cars, t2 has handled 4 cars and t3 has handled 3 cars. So I'm so damn tired I can't even think clearly about this problem.
So, with ax being the amount of cars handled at tx we'd have
a1 + a2 + a3 = 100
2*a1 = 3*a2 = 4*a3
->
a1 + 2/3*a1 + 1/2*a1 = 100
13/6*a1 = 100
->
a1 = 600/13 = 46.154
->
a2 = 1200/39 = 400/13 = 30.769
->
a3 = 300/13 = 23.077
which means that t1 handles 46 cars, t2 handles 31 cars and t3 handles 23 cars.
-
I don't quite understand this part actually. Could you explain it in more detail perhaps? Thanx.
2*a1 = 3*a2 = 4*a3
->
a1 + 2/3*a1 + 1/2*a1 = 100
13/6*a1 = 100
->
a1 = 600/13 = 46.154
->
a2 = 1200/39 = 400/13 = 30.769
->
a3 = 300/13 = 23.077