Dear students,
In this assignment, you need to submit you work to implement File I/O and Filtration.
- Mall class
It should have the following fields and the methods:
Fields:
- id - (String - randomly generated)
- mallName - (String)
- country - (String)
- city - (String)
- yearOpened - (Integer)
- gla_sqft - (Integer - Gross Leasable area in square feets)
- gla_sqmt - (Integer - Gross Leasable area in square meters)
- shops - (Integer)
Methods:
- necessary constructor(s)
- a getter method for each field
- static parseFrom(String mallRecord) : Mall - parses the given string (comma-separated) to create an instance of Mall and returns it. Note that GLA is a string in the file and stores two information. These should be separately stored in the entity in relevant fields.
- parseTo() : String - parses the current mall instance to a string record (comma-separated) to be later stored in a file. Note that the generated string should look like the records in the input source file in a way that there is only one column representing GLA (together both in sqft and sqm)
- static parseTo(Mall mallInstance) : String - parses the given mall instance to a string record (comma-separated) to be later stored in a file. Hint: You should use already defined instance method to delegate the job
It should have the following fields and the methods:
Fields:
- static final MALLS - (List)
Methods:
- static loadMalls() - returns a list of malls reading the original data source
- static saveMalls(List malls, String fileName) - generates a file with the given filename (under the data folder) and stores the list of malls in the file. (You should include column names or header in the file)
- Any additional methods that would help you complete the task can be added.
- Please, carefully follow the instructions above.
- Your program should properly enforce encapsulation, file i/o, collections, and streams
- Your program should prevent invalid operations using proper exceptions and exception handling. Some of them are
the following:
- specified file is not found
- given string cannot be parsed to a mall instance
- attempt to overwrite an existing file
- etc.
When you compile, make sure your .class files are totally isolated from the rest and are never commited and pushed.
- Load all the malls from Largest-Malls.csv
-
Sorting:
- (10 %)Define a method sort(List malls, String fieldName, String order) method to sort the list of all malls based on the given field and order
- Call the sort method to sort all malls based on the country names (first) and city names (second)
- Save the result in a .csv file (name the file as descriptive as possible)(5 %)
- Call the sort method again to sort all malls based on the descending order of the number of shops
- Save the result in a .csv file (name the file as descriptive as possible)(5 %)
-
Filtration:
- (10 %)Define a method filterByCountry(List malls, String countryName) method to select only those malls that are in the given country
- Call the filterByCountry method to find the info about malls in China
- Save the result in a .csv file (name the file as descriptive as possible)(5 %)
- (10 %)Define a method filterByAreaSqFt(List malls, Integer lower, Integer upper) method to select those malls whose GLA in square feets falls in the given range
- Call the filterByAreaSqFt method to find the info about malls whose GLA in square feet is in the range of [4,000,000;6,000,000]
- Save the result in a .csv file (name the file as descriptive as possible)(5 %)
- Note: in case of an invalid field name, country name, throw a meaningful exception instance and handle it back in main
- Record a short video not exceeding 5 minutes to explain the code
as well as the way users can interact with the end product
- Show:
- main blocks of the code base
- each of the features mentioned above
- files that are generated (discuss either in a text editor or in an Excel sheet)
- Upload the video to YouTube and share the link by adding it to your README.md file as the first line.
- Submissions without a video recording will not be graded.
- Please, also refer to the course syllabus about the assignments.
- Each completed feature must be commited and pushed works submitted in just one or two commits are not acceptable.
- This assignment will give you 10 % of the overall.