could anyone help me out with displaying information from my Vehicle
class through my Controller class to my View class. i want to display
the car details onscreen without any print() lines in the vehicle or
controller classes. has any 1 got a solution heres some code.
Vehicle Class
private int findVehicle(String regNo) {
int location = -1;
for(int i = 0; i < vector.size(); i++) {
if(vector.get(i) instanceof Car) {
Car car = (Car)vector.get(i);
if(car.getRegNo().equalsIgnoreCase(regNo)) {
location = i;
}
}
if(vector.get(i) instanceof Van) {
Van van = (Van)vector.get(i);
if(van.getRegNo().equalsIgnoreCase(regNo)) {
location = i;
}
}
}
return location;
}
public void displayDetails(String regNo) {
vector.get(findVehicle(regNo));
}
Controller Class
private void displayDetails() {
String regNo = output.getTheRegNo();
vehicle.displayDetails(regNo);
//output.displayVehicle();
}