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.txt"(create 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:
\table[[id,area,city,type,Year,price,owner],[500,125.2,Erbil,A,2017,75000,Ali],[234,255,Erbil,H,2002,123000,Lana],[121,142,Soly,A,2015,65000,Kareem],[432,175,Soran,H,2021,56000,Aland],[231,2000,Dohuk,F,2011,40000,Muhammad],[455,3500,Soly,F,2001,50000,Sana],[333,100,Soly,A,2020,6000,Amanj],[765,122,Karkuk,H,1990,82000,Lanja]]
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, setters/getters,... methods.
Add the method "applyDiscount" to the class Property which reduced the price of a property by 10%.
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 10 years, apply 10% discount to the price via calling the method you have defined in part "2", 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".
 Object Oriented Programming List of properties in a real estate agency

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!