public class Carro {
private String Marca;
private int Puertas;
private int Velocidad;
private String Color;
Carro(){
this.Marca = "No definida";
this.Puertas = 0;
this.Velocidad = 0;
this.Color = "No definida";
}
Carro(String Marca, int Puertas, int Velocidad, String Color){
this.Marca = Marca;
this.Puertas = Puertas;
this.Velocidad = Velocidad;
this.Color = Color;
}
public void setMarca(String Marca){
this.Marca = Marca;
}
public String getMarca(){
return this.Marca;
}
public void setPuertas(int Puertas){
this.Marca = Marca;
}
public int getPuertas(){
return this.Puertas;
}
public void setVelocidad(int velocidad){
this.Velocidad = velocidad;
}
public int getVelocidad(){
return this.Velocidad;
}
public void setColor (String color){
this.Color = color;
}
public String getColor(){
return this.Color;
}
public void ImprimirCarro(){
System.out.println(
"Mi carro::: \n" +
"Marca: " + this.Marca + "\n" +
"Puertas: " + this.Puertas + "\n" +
"Velocidad: " + this.Velocidad + "\n" +
"Color: " + this.Color
);
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.