ICSE Class 10 Computer Applications
Question 14 of 14
Mathematical Library Methods — Question 14
Back to all questions 14
Question Question 14
Write a program in Java to compute the final velocity of a vehicle using the following formula:
where, u = initial velocity, a = acceleration and s = distance covered; they are entered by the user.
import java.util.Scanner;
public class KboatVelocity
{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
System.out.print("Enter initial velocity: ");
double u = in.nextDouble();
System.out.print("Enter acceleration: ");
double a = in.nextDouble();
System.out.print("Enter distance covered: ");
double s = in.nextDouble();
double v = Math.sqrt(u * u + 2 * a * s);
System.out.println("Final Velocity = " + v);
}
}Output
