Car attributes, initializing, get, set and display
So I have built the following:
Code:
public class Automovil {
String marca;
int modelo;
int numeroDeCaballos;
double precio;
boolean airbag;
public Automovil(String startMarca, int startModelo, int startNumeroDeCaballos, double startPrecio, boolean startAirbag) {
marca = startMarca;
modelo = startModelo;
numeroDeCaballos = startNumeroDeCaballos;
precio = startPrecio;
airbag = startAirbag;
}
public String getMarca() {
return marca;
}
public void setMarca(String startMarca) {
marca = startMarca;
}
public int getModelo() {
return modelo;
}
public void setModelo(int startModelo) {
modelo = startModelo;
}
public int getNumeroDeCaballos() {
return numeroDeCaballos;
}
public void setNumeroDeCaballos(int startNumeroDeCaballos) {
numeroDeCaballos = startNumeroDeCaballos;
}
public double getPrecio() {
return precio;
}
public void setPrecio(double startPrecio) {
precio = startPrecio;
}
public boolean getAirbag() {
return airbag;
}
public void setAirbag(boolean startAirbag) {
airbag = startAirbag;
}
}
How can I initialize my program and set its variables? I know I have to create a new class and set the attributes values, but how do I connect them?