Program to find the Speed of train as per speed of sound | Java implementation of the approach ; Function to find the Speed of train ; Driver code ; calling Function
class GFG { static int speedOfTrain ( float X , float Y ) { float Speed ; Speed = 1188 * ( ( X - Y ) / Y ) ; return ( int ) Speed ; } public static void main ( String [ ] args ) { float X = 8f , Y = 7.2f ; int result = ( speedOfTrain ( X , Y ) ) ; System . out . println ( result + " ▁ km / hr " ) ; } }