Question: Problem C: Trains (Optional) Imagine a two-way straight railway and two trains approaching each other from opposite directions. You need to compute how long (in

Problem C: Trains (Optional) Imagine a two-way straight railway and two trains approaching each other from opposite directions. You need to compute how long (in minutes) would it take for these trains to come side by side. You will also compute how many miles each train travels till then. Write a program to read in the distance (in miles), speeds of the trains (in miles per hour), and output the time to meet in minutes) and the distance traveled by each train (in miles). Sample 1: Input and Output What is the distance between the two trains (in miles)? 4 What is the speed of the first train (in miles per hour)? 120 What is the speed of the second train (in miles per hour) ? 80 The trains will meet in 1.2 minutes. The first train will travel 2.4 miles and the second train will travel 1.6 miles
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
