/* Question: The final velocity of a vehicle can be calculated by using the formula:
V2=u2+2as;
where u= initial velocity, a=acceleration, s=distance covered
Write a Program in Java to calculate and Display the final velocity by taking initial velocity, acceleration and the distance covered as inputs. */
import java.util.*;
public class Velocity
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int u,a,s;
double v;
System.out.println("Enter the initial Velocity, acceleration and distance covered");
u=in.nextInt();
a=in.nextInt();
s=in.nextInt();
v=Math.sqrt((u*u)+(2*a*s));
System.out.println("Final Velocity = "+v);
}
}
No comments:
Post a Comment