0% found this document useful (0 votes)
5 views

Assignment

Assignment

Uploaded by

kientthe186727
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Assignment

Assignment

Uploaded by

kientthe186727
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

o You CAN create more classes /methods/variables (if needed).

o You can change test data by change file data.txt


Question
when finish u need zip folder RollNumber and upload bellow to your class
assignment!

Write Class: follow instruction in bellow given

1. Create a Land class with: owner, address, price data.

2. Create a Iland interface with function f1, f2, f3, f4.

3.Create class named MyLand.java which implements the Ibird Interface.

4.Create Main class with content call the function f1, f2, f3, f4 in MyLand class,
object of the list read from file data.txt same as Lab 4 given.

f1 - Sort the list by price increase if 2 objects have the same price, sort by charAt(3)
in the owner and print out following format (owner,adress,price)

(ha, HaNoi, 1500) (Han, HoaBinh, 500) (Hoa, HaNoi, 2000)

(Han, HoaBinh, 500) (ha, HaNoi, 1500) (Hoa, HaNoi, 2000)

f2 – Find in the List if have more 1 Lands with the same price and address, Add a
number after owner. Ex

(ha, HaNoi, 1500)(Han,HoaBinh,500)(Hoa, HaNoi, 1500)

(ha1,HaNoi, 1500)(Han, HoaBinh, 500)(Hoa2, HaNoi, 1500)

f3. In the input data.txt file, suppose has only one Land for f3 function. If have the
digits in the address print out number of square number in this and print out
following by format: ex1:

(ha, so 4 ngach 64 Hang Buom HaNoi, 1500)

(ha, so 4 ngach 64 Hang Buom HaNoi, 1500, 2)

Ex2:

(Han, Duong 30/4 – Tan Xuan HoaBinh,500)

(Han, Duong 30/4 – Tan Xuan HoaBinh,500, 1)

f4. Find the first most frequent word in the Address (word= a string with out space).
Replace it with character ‘C’. the outout of f4 as example:

(ha, so nha 72a - ngach so 3- duong so 3 Khu do thi xa la – Ha Dong, 1500)

1
(ha, C nha 72a - ngach C 3- duong C 3 Khu do thi xa la – Ha Dong, 1500)

You might also like