import java.util.*;
public class CalculateDistance {
public static void main(String[] args)
{
Scanner scan=new Scanner(System.in);
System.out.print("Enter Value of intial velocity (u):");
int u=scan.nextInt();
System.out.print("Enter Value of acceleration (a):");
int a=scan.nextInt();
System.out.print("Enter Value of Time interval(t):");
int t=scan.nextInt();
double distance=u*t +(a*t)*(a*t)/2.0;
System.out.println("Distance ="+distance);
}
}
Labels:
Java
public class CalculateDistance {
public static void main(String[] args)
{
Scanner scan=new Scanner(System.in);
System.out.print("Enter Value of intial velocity (u):");
int u=scan.nextInt();
System.out.print("Enter Value of acceleration (a):");
int a=scan.nextInt();
System.out.print("Enter Value of Time interval(t):");
int t=scan.nextInt();
double distance=u*t +(a*t)*(a*t)/2.0;
System.out.println("Distance ="+distance);
}
}
Responses
0 Respones to "28. The distance traveled by a vehicle in t seconds is given by u, a"
Post a Comment