Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Distancia {
- private float velocidad;
- private float aceleracion;
- public Distancia(float ace, float vel){
- this.aceleracion=ace;
- this.velocidad=vel;
- }
- public void setAceleracion(float ace){
- this.aceleracion=ace;
- }
- public float getAceleracion(){
- return this.aceleracion;
- }
- public void setVelocidad(float vel){
- this.velocidad=vel;
- }
- public float getVelocidad(){
- return this.velocidad;
- }
- public void calcularDistancia(){
- float dis;
- dis=(this.velocidad*this.velocidad*2)/this.aceleracion;
- System.out.println("La distancia es: "+ " " + dis);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment