Answered step by step
Verified Expert Solution
Link Copied!

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.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".
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions

Question

1. Keep a reasonable distance.

Answered: 1 week ago

Question

1 Why might people resist change?

Answered: 1 week ago