Question: Java: Create a class called Vehicle with the following features: a. It has three private data members (instance variables): one is the manufacturers name (String
Java: Create a class called Vehicle
with the following features:
a.
It has three private data members (instance variables): one is the
manufacturers name (String manufacturer), the second is the number of
cylinders in the engine (int cylinder), and the third is the owner (Person
owner). The class Person is described above.
b.
It has three constructors, a no-argument constructor, a constructor with three
parameters, and a copy constructor. The no-argument constructor will set the
manufacturer to None, cylinder to 0, and owners name to an empty string
. The three parameter constructor will set the manufacturer to the value of
the first parameter, cylinder to the value of the second parameter, and owner to a
copy of the third parameter. The copy constructor has a parameter of type
Vehicle, and it creates a new object which is an exact copy of its argument
object.
c.
It has three accessor methods (getManufacturer, getCylinder, getOwner) and
three mutator methods (setManufacturer, setCylinder, setOwner).
d.
It has a toString method that returns a string containing the manufacturers
name, number of cylinders, and the owners name. (For example,manufacturer=Ford, cylinder= 4, owners Name =Bob)
e.
It has an equals method that returns true if two independent Vehicles are
identical.
Thank you for any help
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
