Q-18-Average acceleration is defined as the change of velocity divided by the time taken to make the change, as shown in the following formula:
π =π£1−π£0 /π‘
Write a java program that prompts the user to enter the starting velocity v0 in meters/second, the ending velocity v1 in meters/second, and the time span t in seconds, and displays the average acceleration.
INPUT :
import java.util.Scanner;
public class NCM {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
double v0,v1,t;
System.out.println("Enter v0,v1 and t:");
v0=sc.nextDouble();
v1=sc.nextDouble();
t=sc.nextDouble();
double a=(v1-v0)/t;
System.out.println("The average acceleration is :"+a);
}
}
OUTPUT :
Enter v0, v1 and t:
5.5
50.9
4.5
The average acceleration is :10.088888888888889
π =π£1−π£0 /π‘
Write a java program that prompts the user to enter the starting velocity v0 in meters/second, the ending velocity v1 in meters/second, and the time span t in seconds, and displays the average acceleration.
INPUT :
import java.util.Scanner;
public class NCM {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
double v0,v1,t;
System.out.println("Enter v0,v1 and t:");
v0=sc.nextDouble();
v1=sc.nextDouble();
t=sc.nextDouble();
double a=(v1-v0)/t;
System.out.println("The average acceleration is :"+a);
}
}
Enter v0, v1 and t:
5.5
50.9
4.5
The average acceleration is :10.088888888888889
No comments:
Post a Comment