Question: JAVA Program ****** Please specify how you call the findLeastAndMostExpensiveAircraft() once with the first array as a parameter and once with the second array. *******

JAVA Program

****** Please specify how you call the findLeastAndMostExpensiveAircraft() once with the first array as a parameter and once with the second array. *******

JAVA Program ****** Please specify how you call the findLeastAndMostExpensiveAircraft() once withthe first array as a parameter and once with the second array.******* Purpose: The purpose of this assignment is to practice class inheritance,and other Object-Oriented Programming concepts such as constructors, access rights, method overriding,etc. The assignment would also allow you to practice the notion ofpackage creation. This assignment contains two parts. You need to complete PartI to be able to do Part II. You should however handle

Purpose: The purpose of this assignment is to practice class inheritance, and other Object-Oriented Programming concepts such as constructors, access rights, method overriding, etc. The assignment would also allow you to practice the notion of package creation. This assignment contains two parts. You need to complete Part I to be able to do Part II. You should however handle each part as if it was a separate assignment (i.e. you should not modify Part I after finishing with it; rather create a copy of that part and use it to create Part II. This is needed so that you can finally submit both parts! Various classes, possibly for transportation or otherwise, are descri - A WheeledTransportation class with the following: number of wheels (int type) and maximum speed (double type). - A Train is a WheeledTransportation that in addition it has the following: number of vehicles (int type) and the name of the starting station (String type), and the name of the destination station (String type), such as Montreal, New York, etc. - A Metro is a Train that in addition it has the following: total number of stops (int type) which indicates the total number of stations between, and including, the starting and destination stations. - A Tram is a Metro that in addition has the following: year of creation (int type), which indicates the year the tram was created. - A Monowheel is a WheeledTransportation that in addition it has the following: maximum weight (double type) which indicates the maximum weight the Monowheel supports. - A Ferry class has the following attributes: maximum speed (double type), and maximum load (double type), which indicates the maximum load that the ferry can array. - An Aircraft class has the following attributes: price (double type, and maximum elevation (double type) which indicates the maximum possible hight the aircraft can reach. - A World War II Airplane is an Aircraft that in addition it has the following attribute: twin engine (boolean type), which indicates whether or not the plane has a twin engine. 2. Write the implementation of the above-mentioned classes using inheritance and according to the specifications and requirements given below: - You must have 6 different Java packages for the classes. The first package will include the WheeledTransportation class. The second package will include the Train, and the Tram classes. The third package will include the Metro class. The fourth package will include Monowheel class. The fifth package will include the Aircraft and the World War II Airoplane classes, and the last package will include the Ferry class. - For each of the classes, you must have at least three constructors, a default constructor, a parameterized constructor (which will accept enough parameters to initialize ALL the attributes of the created object from this class) and a copy constructor. For instance the parameterized constructor of the Tram class must accept 7 parameters to initialize all its 7 attributes. The copy constructor creates a new object that is an exact copy of the passed object. - An object creation using the default constructor must trigger the default constructor of its ancestor classes, while creation using parameterized constructors must trigger the parameterized constructors of the ancestors. - For each of the classes, you must include at least the following methods: accessors, mutators, toString() and equals 0 methods (notice that you are always overriding the last two methods). - The toString( method must display clear description and information of the object (i.e "This Train has 60 wheels, has a maximum speed of 140km/hr. It has 6 vehicles and its starting and destination stations are Montreal and Toronto"). - The equalso method must first verify if the passed object (to compare to) is null and if it is of a different type than the calling object. The method would clearly return false if any of these conditions is true; otherwise the comparison of the attributes is conducted to see if the two objects are actually equal. Two objects are equal if the values of all their attributes are equal. - For all classes you must use the appropriate access rights, which allow most ease of use/access without compromising security. Do not use most restrictive rights unless they make sense! - When accessing attributes from a base class, you must take full advantage of the permitted rights. For instance, if you can directly access an attribute by name from a base class, then you must do so instead of calling a public method from that base class to access the attribute. 3. Write a driver program (that contains the main() method), which will utilize all of your classes. The driver class can be in a separate package or in any of the already existing packages. Besides the main() method, the driver will also include another static method called findLeastAndMostExpensiveAircraft(). The description this is as follows: The findLeastAndMostExpensiveAircraft () should be able to accept an array that contains mixed objects from any of the 8 classes described above, as a parameter. The method however must find both the least-expensive and the most-expensive Aircraft objects in that array (if any exists). If so, the method must find, then display (using toString), the information of these two Aircraft objects. If only one Aircraft object exists in the passed array, then it is considered as the least and the most expensive. If no Aircraft objects are found, the method must display something to that effect. 1. In the main() method you must: - Create at least 16 objects from the 8 classes, and display their information (you must take advantage of the toString() method). - Test the equality of some of the created objects using the equals() method. You should test at least the equality of two objects from different classes, two objects from the same class with different values and two objects with similar values. In other words, you should include enough test cases to test your implementation. - Create two arrays, each of 15 to 20 of these mixed objects and fill these arrays with various objects from these classes. The first array must include at least one object from each of the classes; while the second array should not have any Aircraft objects. (HINT: Again, do you need to add something else to the classes described above? If so; go ahead with that!) - Finally call the findLeastAndMostExpensiveAircraft() once with the first array as a parameter and once with the second array. This should display what is needed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!