Question: Object Oriented Programming List of properties in a real estate agency is saved in a text file named Property.txt ( create the file yourself
Object Oriented Programming
List of properties in a real estate agency is saved in a text file named "Property.txtcreate the file yourself using the sample below data The file stores the information related to each property in one line including the following fields:
id
area
city
type
Year
price
owner
The type can be one of the followings:
A: Apartment
H: House
F: Farm
See the following sample file content:
tableidarea,city,type,Year,price,ownerErbil,AAliErbil,HLanaSoly,AKareemSoran,HAlandDohuk,FMuhammadSoly,FSanaSoly,AAmanjKarkuk,HLanja
Object Oriented Programming
You are required to perform the following tasks:
Define a class Property including the above fields and define all the required constructors, settersgetters methods.
Add the method "applyDiscount" to the class Property which reduced the price of a property by
In the main method do the following tasks:
a Read all the data from the file, create an object of class Property for each line and save them all in an ArrayList.
b For all the properties older than years, apply discount to the price via calling the method you have defined in part above.
c Show list of all properties located in Erbil.
d Define a new property, using optional data and add it to the ArrayList you have created in part a above.
e Save the content of the ArrayList in a new file called "NewProp.txt
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
