Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- If there is a straight section of highway 120 Km between them and Joe travels south towards Bob at 30Kph
- while Bob travels north towards Joe at 25Kph, how long will it be before they meet and how far will each have traveled in that time?
- (d=r/t where d is distance, r is rate and t is time)
- Please show all of your work and if possible write a program that solves the problem for any given rates and distances.
- Thanks for participating and sharing, please invite your friends who might be interested. I ♥ Math for programming! -JpE-
- https://www.facebook.com/groups/ILMFP/
- :: program at bottom ::
- -¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯
- Given: t1 = 0h
- t2 = 0h
- v1 = 30 km/h
- v2 = 25 km/h
- s1(t1) = 0 km
- s2(t1) = 120 km
- Wanted: s(t)
- t
- a(joe) b(bob)
- -----.-------------------------------------------.----
- s(t1) s(t) s(t1)
- ---> v1 v2 <--
- Solution:
- ______________________________________________________
- (1) ERB Joe
- Δs1(t1, t) = s1(t) - s1(t1)
- s1(t) = s1(t1) + Δs1(t1, t)
- s1(t) = s1(t1) + v1.Δt(t1, 1)
- s1(t) = s1(t1) + v1.(t-t1)
- s1(t) = 0 km + 30 km/h.(t-0h)
- s1(t) = 30 km/h . t
- ______________________________________________________
- (2) ERB Bob
- Δs2(t2, t) = s2(t) - s2(t2)
- s2(t) = s2(t2) + Δs2(t2, t)
- s2(t) = s2(t2) + v2.Δt(t2, 1)
- s2(t) = s2(t2) + v2.(t-t2)
- s2(t) = 120 km + -25 km/h.(t-0h)
- s2(t) = 120 km - 25 km/h . t
- ______________________________________________________
- (3) s1(t) = s2(t) (meeting point)
- 30 km/h . t = 120 km - 25 km/h . t
- 55 km/h . t = 120 km
- t = 120 km / 55 km/h
- t = 2,181818 h (2h 10m 54s)
- ______________________________________________________
- (4) distance Joe
- s1(t) = 30 km/h . t
- = 30 km/h . 2,181818h
- = 65,454545 km
- ______________________________________________________
- (5) distance Bob
- s2(t) = 25 km/h . t
- = 25 km/h . 2,181818h
- = 54.545454 km
- I ♥ Math for programming!
- ~Robin "yugecin" Claerhout
- -¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯-¯
- :: Batch program for calculating solution ::
- http://pastebin.com/yEUtQQYH
- (time function not working properly (yet))
- To solve this question:
- Joe:
- Starting distance: 0
- Starting time: 0
- Speed: 30
- Bob:
- Starting Distance: 120
- Starting time: 0
- Speed: -25 (negative because Bob is travelling to Joe)
- Output:
- Meeting time: 2,181 h
- Distance Joe: 65.430 km
- Distance Bob: 54.525 km
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement