Question: write java program without comments without output I need it in less then 2 hours doesn't need to be good Q5. Write a program (Polymorphism)

write java program without comments without output I need it in less then 2 hours doesn't need to be good
Q5. Write a program (Polymorphism) Define a class named Villa contains: Two private instance variables named squareMeters and squareMeterCost of type integer and double respectively. get method for the previous instance variables. A full parameterized constructor which initiaizes the instance variables. A public method named Price which returns double and also prints a message as Villa's price is undefined". Define another class named Classic Villa which is extended from class Villa contains: A two parameter constructor which initializes all the instance variables of its super class (by calling its constructor). An overridden method named Price which returns the price of classic villa: (sqm*cost). Define another class named Luxury Villa which is extended from class Villa contains: A two parameter constructor which initializes all the instance variables of its super class (by calling its constructor). An overridden method named Price which returns the price of luxury villa: (sqm*cost)*1.5 Define a third class named FindCost contains a main method that test the functionality of the above classes as follows: Define three objects of type Villa, Classic Villa, and Luxury Villa. Initilaze with with suitable values. Use only the super class reference to print the price of the three villas
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
