Define a constructor as indicated. Sample output for below program:Year: 0, VIN: -1Year: 2009, VIN: 444555666// ===== Code from file CarRecord.java =====public class CarRecord {private int yearMade;private int vehicleIdNum;public void setYearMade(int originalYear) {yearMade = originalYear;return;}public void setVehicleIdNum(int vehIdNum) {vehicleIdNum = vehIdNum;return;}public void print() {System.out.println("Year: " + yearMade + ", VIN: " + vehicleIdNum);return;}// FIXME: Write constructor, initialize year to 0, vehicle ID num to -1./* Your solution goes here */}// ===== end ===== //===== Code from file CallCarRecord.java =====public class CallCarRecord {public static void main (String args) {CarRecord familyCar = new CarRecord();familyCar.print();familyCar.setYearMade(2009);familyCar.setVehicleIdNum(444555666);familyCar.print();return;}}// ===== end =====

Respuesta :

Answer:

public CarRecord(){

       yearMade = 0;

       vehicleIdNum = -1;

   }

Explanation:

A constructor is used to initialize an object instantly. It does not have a return type and has the same name as class.

Create a constructor and set the year as 0 and vehicleIdNum as -1.

This constructor is the default constructor, initializes the default values for the variables, for this class.

A constructor is a block of code that is called and executed each time an object is created.

The constructor in Java is as follows:

public CarRecord(){

       yearMade = 0;

       vehicleIdNum = -1;

  }

A constructor would have the same name as the class.

The class of the program is CarRecord; so the constructor name is CarRecord()

From the question, variables year and vehicles ID are to be initialized to 0 and  -1 respectively.

So, the variable initialization is:

       yearMade = 0;

       vehicleIdNum = -1;

Hence, the complete code segment is:

public CarRecord(){

       yearMade = 0;        vehicleIdNum = -1;

  }

Read more about constructors at:

https://brainly.com/question/14608885