(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:58 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:
(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: