Part (1) Create a class called HOUSE that has these private instance variables: an owner “string”, an area “double” and a pricePerMeter “double”. The class has the following methods: - A constructor...


Part (1)


Create a class called HOUSE that has these private instance variables: an owner “string”, an area “double” and a pricePerMeter “double”. The class has the following methods:


- A constructor that takes owner, price and area. Theconstructor sets the class variables to these values and in case the owner is empty string, set its instance variable to “unknown”.

- A mutator method (set) and an accessor method (get) for the owner variable.

- A method getPrice that returns the total price of the house. The total price of the house is computed by multiplying the area by the price per meter.

- A method print that prints the owner, area and price per meter.


Part (2)
Write a Java application that asks the user to enter the owner, area and price per meter of the house. Create an object from House class you defined in Part (1) and use it to display the house information and the total price of the house.



Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here