Find The Length Of Platform - Java Quiz Question


Write a program to find the length of the platform. If the time taken to cross a pole, time taken to cross a platform and the length of the train is given.

Input( time of crossing a pole, time of crossing a platform, trainLength ) Output
20, 60, 100 ( 60 * 100 ) - ( 20 * 100 ) / 20 = 6000 - 2000 / 20 = 4000 / 20 = 200
30, 120, 200 ( 120 * 200 ) - ( 30 * 200 ) / 30 = 24000 - 6000 / 30 = 18000 / 30 = 600



class ClassPlatformOperation
{
    public static void main(String s[])
    {
        double platformLength = calculateLength( 40, 80, 200 );
        System.out.println("The length of platform is " + platformLength );

    }


    public static double calculateLength(double poleCrossingTime, double platformCrossingTime, double trainLength)
        {
        }

}