Why Choose Us?
0% AI Guarantee
Human-written only.
24/7 Support
Anytime, anywhere.
Plagiarism Free
100% Original.
Expert Tutors
Masters & PhDs.
100% Confidential
Your privacy matters.
On-Time Delivery
Never miss a deadline.
JAVA Define a constructor as indicated
JAVA Define a constructor as indicated. Sample output for below program:
Year: 0, VIN: -1 Year: 2009, VIN: 444555666 ....CODE BELOW
// ===== Code from file CarRecord.java =====
public class CarRecord {
private int yearMade;
private int vehicleIdNum;
public void setYearMade(int originalYear) {
yearMade = originalYear;
}
public void setVehicleIdNum(int vehIdNum) {
vehicleIdNum = vehIdNum;
}
public void print() {
System.out.println("Year: " + yearMade + ", VIN: " + vehicleIdNum);
}
// FIXME: Write constructor, initialize year to 0, vehicle ID num to -1.
//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();
}
}
// ===== end =====
Expert Solution
Given below is the modified code for the question.
To indent code in eclipse , select code by pressing ctrl+a and then indent using ctrl+i
Please do rate the answer if it was helpful. Thank you
// ===== Code from file CarRecord.java =====
public class CarRecord {
private int yearMade;
private int vehicleIdNum;
public void setYearMade(int originalYear) {
yearMade = originalYear;
}
public void setVehicleIdNum(int vehIdNum) {
vehicleIdNum = vehIdNum;
}
public void print() {
System.out.println("Year: " + yearMade + ", VIN: " + vehicleIdNum);
}
// FIXME: Write constructor, initialize year to 0, vehicle ID num to -1.
//solution goes here//
public CarRecord() {
yearMade = 0;
vehicleIdNum = -1;
}
}
output
====
Year: 0, VIN: -1
Year: 2009, VIN: 444555666
Archived Solution
You have full access to this solution. To save a copy with all formatting and attachments, use the button below.
For ready-to-submit work, please order a fresh solution below.





