subject

Now, you will create additional classes that represent the different components of a car - the engine, the fuel tank, the wheels, etc. These classes should have methods related to their behaviors, and properties representing their various states (an engine is running or not, tires have levels of wear, etc). 1. Every class representing a car part should inherit from a superclass called "CarPart." The CarPart class will have at least the following states and behaviors:
2. condition - an integer that represents the remaining durability of the part (starts at 100, goes down to 0 when the part is broken)
3. status() - a method that prints the condition of the part to the console.
4. The CarPart class should also implement a Functional interface, which declares a method "function()".
5. Each subclass of CarPart should have at least one state unique to that part (like the number of cylinders in an engine, or the fuel level of a fuel tank). Each subclass should also implement the inherited function() method to print a unique message to the console that incorporates the variables unique to that class. The CarPart subclasses should not define unique methods, unless those methods are called from their overriden function() or status() methods.
6. Make sure that your Car class creates an instance of each CarPart subclass, as part of its constructor. These instances should be added to a collection of CarPart reference variables.
7. The run() method of your Car class should iterate through the Car's collection of CarPart references, which stores the instances of the CarPart subclasses. On each iteration, the function() method of the current object in the collection should be invoked.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:10
Alook-up table used to convert pixel values to output values on a monitor. essentially, all pixels with a value of 190 or above are shown as white (i.e. 255), and all values with a value of 63 or less are shown as black (i.e. 0). in between the pixels are scaled so that a pixel with a value p is converted to a pixel of value 2/127 βˆ’+3969). if a pixel has a value of 170 originally, what value will be used to display the pixel on the monitor? if a value of 110 is used to display the pixel on the monitor, what was the original value of the pixel?
Answers: 1
question
Computers and Technology, 23.06.2019 07:50
Most shops require the technician to enter a starting and ending time on the repair order to track the actual time the vehicle was in the shop and closed out by the office. this time is referred to as _ time ? a. comeback b. ro c. cycle d. lead
Answers: 1
question
Computers and Technology, 23.06.2019 10:20
Suppose there is a relation r(a, b, c) with a b+-tree index with search keys (a, b).1. what is the worst-case cost of finding records satisfying 10 < a < 50 using this index, in terms of the number of records n1, retrieved and the height h of the tree? 2. what is the worst-case cost of finding records satisfying 10 < a < 50 and 5 < b < 10 using this index, in terms of the number of records n2 that satisfy this selection, as well as n1 and h defined above? 3. under what conditions on n1 and n2, would the index be an efficient way of finding records satisfying the condition from part (2)?
Answers: 1
question
Computers and Technology, 23.06.2019 23:30
Worth 50 points answer them bc i am not sure if i am wrong
Answers: 1
You know the right answer?
Now, you will create additional classes that represent the different components of a car - the engin...
Questions
question
English, 26.01.2021 17:20
question
Mathematics, 26.01.2021 17:20
question
Mathematics, 26.01.2021 17:20
question
Mathematics, 26.01.2021 17:20
Questions on the website: 13722367