|
-
Jan 28th, 2003, 01:34 AM
#1
Thread Starter
Junior Member
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.
-
Jan 28th, 2003, 08:41 PM
#2
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.
Last edited by CornedBee; Jan 28th, 2003 at 08:53 PM.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 3rd, 2003, 09:04 PM
#3
Thread Starter
Junior Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|