subject

1, Create a Java project in eclipse, called "PracticeCar" 2, Create a class called "Simulator", with a main() method.
3, Create a "Car" class, with a run() method.
4, Inside the main() method of Simulator, create an instance of a Car object, and invoke that object's run() method. 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: 1, condition - an integer that represents the remaining durability of the part (starts at 100, goes down to 0 when the part is broken) 2, status () - a method that prints the condition of the part to the console. 2, The CarPart class should also implement a Functional interface, which declares a method "function()". 3, 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. If you create any custom methods, you should NOT invoke those methods directly from the car or Simulator class. Those methods (if you write them) should be called from the overriden function () or status () methods. 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. 5, 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: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:10
When you reach a yield sign, yield to cross traffic and before you enter the intersection. a. flash your headlights b. wait for a signal c. wait five seconds d. wait for a safe gap
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
Consider the following declarations (1, 2, 3, 5, 7)class bagtype{public: void set(string, double, double, double, double); void print() const; string getstyle() const; double getprice() const; void get(double, double, double, double); bagtype(); bagtype(string, double, double, double, double); private: string style: double l; double w; double h; double price; }; a.) write the definition of the number function set so that private members are set according to the parametersb.) write the definition of the member function print that prints the values of the data membersc.) write the definition of the default constructor of the class bagtype so that the private member variables are initialized to "", 0.0, 0.0, 0.0, 0.0, respectively d.) write a c++ statement that prints the value of the object newbag.e.) write a c++ statement that declares the object tempbag of type bagtype, and initialize the member variables of tempbag to "backpack", 15, 8, 20 and 49.99, respectively
Answers: 3
question
Computers and Technology, 23.06.2019 08:00
What is a scenario where records stored in a computer frequently need to be checked
Answers: 2
question
Computers and Technology, 23.06.2019 18:30
Where can page numbers appear? check all that apply. in the header inside tables in the footer at the bottom of columns at the top of columns
Answers: 1
You know the right answer?
1, Create a Java project in eclipse, called "PracticeCar" 2, Create a class called "Simulator", wit...
Questions
question
Biology, 13.11.2020 04:10
question
History, 13.11.2020 04:10
question
German, 13.11.2020 04:10
question
Mathematics, 13.11.2020 04:10
question
Biology, 13.11.2020 04:10
question
Mathematics, 13.11.2020 04:10
Questions on the website: 13722363