pablosotol

Tarea

Apr 12th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. public class Distancia {
  2.    
  3.        private float velocidad;  
  4.        private float aceleracion;
  5.    
  6.        public Distancia(float ace, float vel){
  7.               this.aceleracion=ace;
  8.               this.velocidad=vel;
  9.        }
  10.        
  11.        public void setAceleracion(float ace){
  12.               this.aceleracion=ace;
  13.        }
  14.        
  15.        public float getAceleracion(){
  16.               return this.aceleracion;
  17.        }
  18.        
  19.        public void setVelocidad(float vel){
  20.               this.velocidad=vel;
  21.        }
  22.        
  23.        public float getVelocidad(){
  24.              return this.velocidad;
  25.        }
  26.        
  27.        public void calcularDistancia(){
  28.               float dis;
  29.               dis=(this.velocidad*this.velocidad*2)/this.aceleracion;
  30.               System.out.println("La distancia es: "+ " " + dis);
  31.        }
  32.    
  33. }
Advertisement
Add Comment
Please, Sign In to add comment