Complete the Java code that uses the concept of inheritance to demonstrate dynamic method dispatching.
Class AirPlane has the following members:
modelmodelmodeldisplay to display the text: Inside an anonymous airplaneClasses Boeing and AirBus should be defined in such a way that any object of Boeing or AirBus can be assigned to a reference variable of type AirPlane. See the main method to understand the context.
Boeing, method display should print the message Inside Boeing followed by the model of the Boeing.AirBus, method display should print the message Inside AirBus followed by the model of the AirBus.What you have to do:
model inside class AirPlanedisplay inside class AirPlaneBoeing and AirBusComplete the Java code that uses the concept of inheritance to demonstrate dynamic method dispatching. Class `AirPlane` has the following members: - Private instance variable `model` - Constructor to initialize `model` - Accessor method for `model` - Method `display` to display the text: `Inside an anonymous airplane` Classes `Boeing` and `AirBus` should be defined in such a way that any object of `Boeing` or `AirBus` can be assigned to a reference variable of type `AirPlane`. See the main method to understand the context. - For an object of `Boeing`, method `display` should print the message `Inside Boeing` followed by the model of the Boeing. - For an object of `AirBus`, method `display` should print the message `Inside AirBus` followed by the model of the AirBus. What you have to do: - Define an accessor method for `model` inside class `AirPlane` - Define method `display` inside class `AirPlane` - Define classes `Boeing` and `AirBus` Write a program that takes input to create an array of `Staff` objects and prints the remuneration of each staff for their duties. `Faculty` should be assigned to Invigilation duty, and `Hod` should be assigned to Squad duty. Abstract class `Staff` has the following members: - `String name`, `String duty`, and `int num` as private instance variables, where `duty` is the type of duty, which may be either `Invigilation` or `Squad`, and `num` is the number of hours of duty. - Constructor to initialize the instance variables - Required accessor methods - Method `toString()` to return the name of the staff - Abstract method `abstract String remuneration()` Class `Faculty` is a child class of `Staff` and has the following members: - Constructor to initialize the instance variables - Method `remuneration()` returns the remuneration as `num * 150` if the duty is `Invigilation`, otherwise returns the string `Wrong duty assigned`. Class `Hod` is a child class of `Staff` and has the following members: - Constructor to initialize the instance variables - Method `remuneration()` returns the remuneration as `num * 500` if the duty is `Squad`, otherwise returns the string `Wrong duty assigned`. Class `ExamBranch` has the following members: - Method `printStaffRemunerations` that prints the name and remuneration of the staff if they are assigned valid duty, otherwise prints the name and the corresponding error message, for each staff. - `main` method accepts the name, duty, and number of hours of two `Faculty` members followed by that of two `Hod`s, and invokes method `printStaffRemunerations`. What you have to do: - Define method `printStaffRemunerations` in class `ExamBranch` Write a Java program that, given as input the names of resorts in a tourist place and the ratings scored by each of them in 3 consecutive months, prints the names of those resorts which have scored at least 4 in all the months. Complete the program as specified below. Class `Place` has/should have the following members: - Private instance variable `Map<String, ArrayList<Integer>> resortMap` (maps the resort name to the list of ratings scored by it in each month). - A constructor to initialize the instance variable. - An accessor method to access the instance variable. Class `FClass` has the following members: - A method `getFinalList()` that takes an object of class `Place` as a parameter and returns a list of resort names which have scored at least 4 in all the months. - `main()` method does the following: - Accepts inputs to instantiate an object of `Place`. The input is accepted in the order: resort name followed by the list of its ratings. - Invokes method `getFinalList()` to get the list of resort names which have a rating of at least 4 in all the months. - Prints the list returned by the method `getFinalList()`. What you have to do: - Define method `getFinalList()` of class `FClass`.