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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started