$25
In this assignment you will practice using Data Structures and Object Oriented concepts in Java. Your implementation should target the most efficient algorithms and data structures. . You should use one or more of the below data structures:
- ArrayList :
- JavaDoc: http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html - Tutorial: http://docs.oracle.com/javase/tutorial/collections/interfaces/list.html - HashSet :
- JavaDoc: http://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html - Tutorial: http://docs.oracle.com/javase/tutorial/collections/interfaces/set.html - HashMap :
- JavaDoc: http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html
- Tutorial: http://docs.oracle.com/javase/tutorial/collections/interfaces/map.html
Question 1
You are provided with the Data class that contains a users array (Data.users) which is an array of users. Each element in the array represents a single user record. Each record is a string formatted as : firstname,lastname,age,email,gender,city,state. You are asked to perform the following tasks:
1. Your implementation for this question should be included in MainPart1.java file.
2. Create a User class that should parse all the parameters for each user. Hint: extract each value from a user's record using Java's String.split() method and set the delimiter to a comma, see provided code below. Each user record should to be assigned to a User object.
3. Your goal is to Print out the TOP 10 oldest users.
4. Hint: To sort use the Collections.sort(). http://docs.oracle.com/javase/6/docs/api/java/util/ Collections.html
Question 2
Using the same Data.users array. You are asked to perform the following tasks:
1. Your implementation for this question should be included in MainPart2.java file.
2. The goal is to count the number of users living each state. Print out the list of State, Count order in ascending order by count.
Question 3
This is a simple programming question that focuses on finding the longest increasing subarray. Given the array A = {1,2,3,2,5,2,4,6,7} the longest increasing subarray is {2,4,6,7}, note that the values have to be contiguous. You are asked to perform the following tasks:
1. Your implementation for this question should be included in MainPart3.java file. Implement the printLongestSequence method. You are provided with example inputs and outputs in the provided Java project.
Question 4
In this question you will use the Data.users and Data.otherUsers arrays that include a list of users. You are asked to perform the following tasks:
1. Your implementation for this question should be included in MainPart4Bonus.java.
2. The goal is to print out the users that are exist in both the Data.users and Data.otherUsers. Two users are equal if all their attributes are equal.
3. Print out the list of users which exist in both Data.users and Data.otherUsers. The printed list of users should be sorted by state in descending order.