- Home
- Chapter 1 - Object Oriented Programming Concepts
- Object Oriented Programming Concepts
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions
- Chapter 2 - Introduction to Java
- Introduction to Java
- Multiple Choice Questions
- Assignment Questions
- Chapter 3 - Values and Data Types
- Values and Data Types
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions
- Chapter 4 - Operators in Java
- Operators in Java
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions
- Chapter 5 - User-Defined Methods
- User-Defined Methods
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions
- Chapter 6 - Input in Java
- Input in Java
- Multiple Choice Questions
- Assignment Questions and Programs
- Chapter 7 - Mathematical Library Methods
- Mathematical Library Methods
- Multiple Choice Questions
- Assignment Questions
- Chapter 8 - Conditional Constructs in Java
- Conditional Constructs in Java
- Multiple Choice Questions
- Assignment Questions and Programs
- Chapter 9 - Iterative Constructs in Java
- Iterative Constructs in Java
- Multiple Choice Questions
- State whether the given statements are True or False
- Assignment Questions and Programs
- Chapter 10 - Nested for loops
- Nested for loops
- Assignment Questions and Programs
- Chapter 11 - Constructors
- Constructors
- Multiple Choice Questions
- Assignment Questions and Programs
- Chapter 12 - Library Classes
- Library Classes
- Multiple Choice Questions
- Assignment Questions
- Chapter 13 - Encapsulation and Inheritance
- Library Classes
- Multiple Choice Questions
- Assignment Questions
- Chapter 14 - Arrays
- Library Classes
- Multiple Choice Questions
- Assignment Questions
- Chapter 15 - String Handling
- Library Classes
- Multiple Choice Questions
- Assignment Questions
Mathematical Library Methods
Chapter 7
Mathematical Library Methods
Class 10 - Logix Kips ICSE Computer Applications with BlueJ
![]() Share with a Friend |
Java Program: Final Velocity Calculation
14. Write a program in Java to compute the final velocity of a vehicle using the following formula:
v2 = u2 + 2as
where, u = initial velocity, a = acceleration and s = distance covered; they are entered by the user.
Given Formula
Where:
- u = initial velocity
- a = acceleration
- s = distance covered
import java.util.Scanner;
public class FinalVelocity {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Input values
System.out.print("Enter initial velocity (u): ");
double u = sc.nextDouble();
System.out.print("Enter acceleration (a): ");
double a = sc.nextDouble();
System.out.print("Enter distance covered (s): ");
double s = sc.nextDouble();
// Calculate final velocity
double v = Math.sqrt((u * u) + (2 * a * s));
// Output
System.out.println("Final velocity (v) = " + v);
sc.close();
}
}
Output
Sample Input Enter initial velocity (u): 10 Enter acceleration (a): 2 Enter distance covered (s): 50 Sample Output Final velocity (v) = 17.320508075688775
Explanation
- The program takes u, a, and s from the user using the Scanner class.
- It calculates u2+2as using arithmetic operators.
- Math.sqrt() is used to find the square root to obtain the final velocity.
- The result is displayed.
