Untitled

 avatar
unknown
plain_text
2 years ago
1.5 kB
4
Indexable
// Title : Calculation of Distance Calcuation due to the constant Acceleration
// Author : Yeamin Adib


import java.util.Scanner;

public class calculation { 
     
     public static void main (String [] args) {
          
          Scanner scan = new Scanner(System.in);
          
          double a = 0, t=0, v0=0, x0=0, x=0;
          
          System.out.print("Enter the Starting Distance : ");
          x0 = scan.nextDouble();
          
          System.out.print("Enter the Initial Velocity : ");
          v0 = scan.nextDouble();
     
          System.out.print("Enter the Time : ");
          t = scan.nextDouble();
         
          System.out.print("Enter the acceleration : ");
          a = scan.nextDouble();
         
                  
         
         
         // calc
         
         x = x0 + (v0 * t) + (0.5 * a * (t * t));
         
         
     
          
          
          //display 
          
          System.out.print("The given time : " + t);
          System.out.println();
          System.out.print("The Acceleration : " + a);
          System.out.println();
          System.out.print("The Initial Distance : " + x0);
          System.out.println();
          System.out.print("The Initial Velocity : " + v0);
          System.out.println();
          System.out.print("The Distance Calculation Done : " + x + " in meters");
          
          
          
     }
     
     
     }
Editor is loading...