Question: Can you modify this for me please? Modify your program from Assignment 3 that defined and tested a vehicle class with a single engine to

Can you modify this for me please?
 Can you modify this for me please? Modify your program from
Assignment 3 that defined and tested a vehicle class with a single
engine to represent either a electric engine vehicle or an internal combustion
vehicle. Pay careful attention to changes within each individuall class The Vehicle
class represents a single vehicle. For the purpose of this assignment, assume
that each of these vehicles contains one of two engines: either an

Modify your program from Assignment 3 that defined and tested a vehicle class with a single engine to represent either a electric engine vehicle or an internal combustion vehicle. Pay careful attention to changes within each individuall class The Vehicle class represents a single vehicle. For the purpose of this assignment, assume that each of these vehicles contains one of two engines: either an internal combustion or electric engine. The internalCombustionEngine class and ElectricEngine class are both subclasses of the Engine class The Vehicle class should contain: .An Engine data member named engine that contains an Engine instance (which can either be electric or internal combustion). .A String make that sets the make for the vehicle. This should default to Toyabu * A String modethat sets the model for the vehicle This should default to-prata" .A default no-arg constructor that creates a default Vehicle. Set your default values here by using the appropriate set methods .A constructor that allows the client to set the engine, vehicle make, and vehicle model e Accessor and mutator methods for all data members . A method named toString) that returns a String indicating the make, model, internal combustion engine's type and number of cylinders and/or electric engine's type and output rating. See sample output for the needed format The Engine class should contain .A String data member named type that indicates the type of engine. This should default to internal combustion .A default no-arg constructor that creates a defauilt Engine. Set your default values here by using calling the other constructor with the this keyword and the appropriate default values 71 kW for electric, 4 cylinders for internal combustion). .A constructor that allows the client to set the type of engine with a parameter Accessor and mutator methods for all data members. Mutators should check values as .A method named toString) that returns a String indicating the type of engine as a String The InternalCombustionEngine class is a subclass of Engine and should contain . An int data member named cylinders that indicates the number of cylinders. This should default to 4. In the mutator, make sure the value being set is not negative. If a negative value is passed in, set it to 4 .A default no-arg constructor that creates a default InternalCombustionEngine. Set your default values here by using calling the other constructor with the this keyword and the appropriate default values . A constructor that allows the client to set the cylinders with a parameter Accessor and mutator methods for all data members. Mutators should check values as described above. . A method named toStringo0 that returns a String indicating the type of engine and the number of cylinders as a String. Use the super keyword to get the type of engine. The ElectricEngine class is a subclass of Engine and should contain: . An int data member named outputRating that gives the rated output of an electric engine. This should default to 71In the mutator, make sure the value being set is not negative. If a negative value is passed in, set it to 71 A default no-arg constructor that creates a default Electr drgne. Set your default values *

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To address the requirements provided some adjustments are necessary to align with the described structure and functionality Here is a more refined ver... View full answer

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!