(a) The class is to be called Car. (b) The class requires two private fields called year of type int and make of type St
Posted: Fri Jun 10, 2022 11:57 am
(a) The class is to be called Car.
(b) The class requires two private fields called year of type int and make of type String.
(c) Add a public constructor to the class that takes two parameters. The first parameter is of type int and the second parameter is of type String. Use the first parameter to set the year field, and the second parameter to set the make field.
(d) Write standard getter methods for the two fields.
(e) Write standard setter methods for the two fields.
(f) Write a public method called toString that takes no parameters and returns a string of the following form:
The year and make should be replaced by the actual year and make of the car.
(g) Write a public method with the signature equals(Car) that returns true if the fields of the actual parameter have the same values as the fields of this object, and returns false otherwise.
(b) The class requires two private fields called year of type int and make of type String.
(c) Add a public constructor to the class that takes two parameters. The first parameter is of type int and the second parameter is of type String. Use the first parameter to set the year field, and the second parameter to set the make field.
(d) Write standard getter methods for the two fields.
(e) Write standard setter methods for the two fields.
(f) Write a public method called toString that takes no parameters and returns a string of the following form:
The year and make should be replaced by the actual year and make of the car.
(g) Write a public method with the signature equals(Car) that returns true if the fields of the actual parameter have the same values as the fields of this object, and returns false otherwise.