Question: JAVA 1. Create a class named Vehicle. A vehicle has a VIN number, which is composed of digits and letters. a. Create a one argument

JAVA

1. Create a class named Vehicle. A vehicle has a VIN number, which is composed of digits and letters. a. Create a one argument Constructor that initializes the class variable Vin number. b. Create an accessor method for the Vin number. c. Create a toString method. The method header is String toString(). The toString method returns the VIN number. 2. Create a class MotorCycle. a. MotorCycle is a sub class of Vehicle. b. MotorCycle has class variables for i. Number of wheels ii. Weight. c. Create accessor and mutator methods for each class variable. d. Create any Constructors that you think are necessary. Use the super keyword in the MotorCycle constructor to call the Vehicle one argument constructor, passing the value of the VIN number. Consider creating a three argument MotorCycle constructor having inputs of VIN number, number of wheels and weight. e. Override the toString method. MotorCycles toString returns a String containing the VIN Number, number of wheels and weight. 3. Create a main method. a. Instantiate a MotorCycle, having VIN number 123NC, two wheels, and weight 1500.0 pounds. b. Call the MotorCycle toString method and display VIN number, number of wheels and weight.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!