Menu
Question Index
...

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

Input(time of crossing a pole, time of crossing a platform) Output
20, 60 ( 20 * 400 ) / ( 60 - 20 ) = 8000 / 40 = 200
40, 80 ( 40 * 400 ) / ( 80 - 40 ) = 16000 / 40 = 400



class ClassTrainOperation
{
    public static void main(String s[])
    {
        double trainLength = calculateLength(20, 60);
        System.out.println("The length of train is " + trainLength);

    }


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

}

Doubts

Problems

Topic: Basic Arithmetic Operators In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App