Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started