Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. [10 points] (Vehicle Class -Submit Vehicle.java) Create a Vehicle class with attributes: make, model, year and color - which defaults to blank and/or 0
3. [10 points] (Vehicle Class -Submit Vehicle.java) Create a Vehicle class with attributes: make, model, year and color - which defaults to blank and/or 0 (depending on datatype) and Silver for color. Provide a default constructor) as well as one or more constructors) that have parameters to set the attributes (i.e. overloaded constructor methods). Provide a toString) method that displays or outputs all the vehicle information. . Provide set) methods for each attribute . Provide get) methods for each attribute. . (examples of set) and get) methods are in Fig 8.5. We have not learned exception handling yet so not required, however we do need to validate input parameter. If invalid, output message that it is an invalid and set attribute to its default value. . Use enumeration for the Color, you choose your valid colors (i.e. SILVER, RED, BLUE. BLACK etc). Below is a simple example of how to use enumeratiorn 4. [10 points] - submit VehicleTest java that instantiates and uses your user-defined Vehicle data-type. Be sure to create a few Vehicle objects and use your default constructor as well as your other constructors. Use your set and get methods to change attributes and always call the toString) method to display all the vehicle information before and after changing attributes. If you want you can get input from the user to change attributes as well. Here is a start to your Vehicle Test program: Vehicielestiaa
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