An object's momentum is its mass multiplied by its velocity. Write a program that expects an object's mass (in kilograms) and velocity ( in meters per second) as inputs and prints its momentum.
This program used Scanner method for getting user's input. Save this file as Momentum.java.
This program used Scanner method for getting user's input. Save this file as Momentum.java.
01 | import java.util.Scanner; |
02 |
03 | public class Momentum { |
04 | public static void main(String [] args) { |
05 | Scanner in = new Scanner(System.in); |
06 | double mass = 0.0 ; |
07 | double velocity = 0.0 ; |
08 |
09 | System.out.print( "Enter object's mass in kilograms: " ); |
10 | mass = in.nextDouble(); |
11 |
12 | System.out.print( "Enter object's velocity in meter/second: " ); |
13 | velocity = in.nextDouble(); |
14 |
15 | System.out.println( "The momentum is: " + (mass * velocity)); |
16 |
17 | } |
18 | } |
Great article with excellent idea!Thank you for such a valuable article. I really appreciate for this great information.. velocity calculator
ReplyDeleteCalculate The Momentum Of An Object In Java ~ Internet-Publiclab >>>>> Download Now
ReplyDelete>>>>> Download Full
Calculate The Momentum Of An Object In Java ~ Internet-Publiclab >>>>> Download LINK
>>>>> Download Now
Calculate The Momentum Of An Object In Java ~ Internet-Publiclab >>>>> Download Full
>>>>> Download LINK QT