Advertisement
Guest User

DemoAuto

a guest
Sep 16th, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.x;
  2.  
  3. class Auto
  4. {
  5.   double distancia, tiempo;
  6.  
  7.     void capturar()
  8.     {
  9.     Scanner leer=new Scanner (System.in);
  10.     System.out.println("Digite la Distancia: ");
  11.     distancia=leer.nextdouble();
  12.     System.out.println("Digite el Tiempo: ");
  13.     tiempo=leer.nextdouble();
  14.     }
  15.  
  16.     void resultado ()
  17.     {
  18.     double velocidad;
  19.     velocidad=distancia/tiempo;
  20.     System.out.println("la Velocidad es: "+velocidad);
  21.     }
  22. }
  23.  
  24. class DemoAuto
  25. {
  26. public static void main (String args [])
  27.  
  28. Auto a1=new Auto();
  29. System.out.println();
  30. a1.capturar();
  31. a1.resultado();
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement