Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using Java, Java class for Car: First create the Car class with some required instance variables, such as make, model, year, price, speed, maxSpeed, isOn,
Using Java,
Java class for Car: First create the Car class with some required instance variables, such as make, model, year, price, speed, maxSpeed, isOn, isMoving, and any other properties you like to add. Provide couple of constructors for initializing different set of important properties, such as make, model, year, and price. Make sure that you do not repeat initialization of instance variables in every constructor, and instead call one constructor from another one when needed to prevent code repetition. Provide required accessor (getter) and mutator (setter) methods. Especially, accelerate, decelerate, turnOn, turnoff, stop, etc. Test the class by creating a tested class. Inside the tester class, create couple of Car's instance objects and change their statuses by calling corresponding methods, and compare the actual and expected outputs. Provide standard Java documentation for the Car class and create the html for the documentation. Modify the Car class by adding properties, fuel efficiency, measured in liters/km, and a certain amount of fuel in the gas tank. Provide a constructor to initialize a specific fuel efficiency and also the initial fuel level as 0. Supply a method drive that simulates driving the car for a certain distance, reducing the amount of gasoline in the fuel tank. Also, supply methods getGasInTank, returning the current amount of gasoline in the fuel tank, and addGas, to add gasoline to the fuel tank. You may assume that the drive method is never called with a distance that consumes more than the available gas. After implementation the class, test it again in the CarTester class that tests all the new methodsStep 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