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 will be graded based on the efficiency of your implementation. You will not be awarded any points if you use simple nested loops to implement the below tasks. 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 Question 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. YourimplementationforthisquestionshouldbeincludedinMainPart1.javafile. 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. Each user record should to be assigned to a User object. 3. YourgoalistoPrintouttheTOP10oldestusers. 4. Hint: To sort use the Collections.sort(). http://docs.oracle.com/javase/6/docs/api/java/util/ Collections.html
also I shared the file in goolgle drive:
https://drive.google.com/file/d/1YJiug2s21mzYoXkeoQocZeNg-yz5AOZt/view?usp=sharing
https://drive.google.com/file/d/1pylRrOhNUFthzzK-ZCs5Uh5I4DyeMDBW/view?usp=sharing
//code screenshot


//code to copy
package edu.sfsu.cs.datastructures;
import java.util.*;
import java.lang.*;
import java.io.*;
class User
{
private String firstName,lastName,email,gender,city,profession;
private int age;
public User(String firstName,String lastName,int age,String email,String gender, String city,String profession)
{
this.firstName=firstName;
this.lastName=lastName;
this.age=age;
this.email=email;
this.gender=gender;
this.city=city;
this.profession=profession;
}
String getfirstName()
{
return firstName;
}
int getAge()
{
return age;
}
public String toString()
{
return firstName+","+lastName+","+age+","+email+","+gender+","+city+","+profession;
}
};
class Sortbyage implements Comparator<User>
{
// Used for sorting in ascending order of
// roll number
public int compare(User a, User b)
{
return (b.getAge() - a.getAge()); //desending order
}
};
public class MainPart1 {
/*
* Question 1:
* - In this question you will use the Data.users array that includes
* a list of users. Formatted as : firstname,lastname,age,email,gender,city,state
* - Create a User class that should parse all the parameters for each user.
* - Insert each of the users in a list.
* - Print out the TOP 10 oldest users.
* */
private static ArrayList<User> userlist = new ArrayList<User>();
public static void main(String[] args) {
//example on how to access the Data.users array.
/* for (String str : Data.users) {
System.out.println(str);
}*/
for (String str : Data.users) {
String[] userval=str.split(",");
//System.out.println(userval[0]);
User newuser=new User(userval[0],userval[1],Integer.parseInt(userval[2]),userval[3],userval[4],userval[5],userval[6]);
userlist.add(newuser);
}
Collections.sort(userlist, new Sortbyage());
for(int i=0;i<10;i++)
{
System.out.println(userlist.get(i));
}
}
};
//output screenshot

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 will be graded...
For practice using exceptions, this exercise will use a try/catch block to validate integer input from a user. Write a brief program to test the user input. Use a try/catch block, request user entry of an integer, use Scanner to read the input, throw an InputMismatchException if the input is not valid, and display "This is an invalid entry, please enter an integer" when an exception is thrown. InputMismatchException is one of the existing Java exceptions thrown by the Scanner...
QUESTION The ReadFile class opens and reads a text file. The WriteFile class opens and writes to a file. Compile and run these programs. There are several ways to read/write text files. The examples shown here are just one way of achieving this. Look at the API for the BufferedReader class. The readline() method is a simple way to read the text file line by line. It returns null when the end of the file has been reached. https://docs.oracle.com/javase/8/docs/api/java/io/BufferedReader.html Look...
Could I get some help with this assignment In this assignment, you'll write a program which reads a text file, and prints a histogram of its word sizes. So, for example, the historgram should show the number of words of length 1, of length 2, etc., up to the number of words of length n, where n is some constant defined in your program. To obtain text files that are suitably long, you could try Project Gutenberg, a site containing...
Queues and Stacks Purpose: To review queues and stacks in Java, and to use the built-in Stack class and Queue interface. The Stack class is a generic class containing these methods: public void push(E value) - pushes a new value onto the Stack public E pop() - pops the next value off of the stack and returns it; throws EmptyStackExceptionl if stack is empty public E peek() - returns the next value on the Stack but does not pop it...
Source material: Object-Oriented Data Structures Using Java, 3rd Edition by Nell Dale. What is the answer to exercise 13 in chapter 3 (page 232)?? "A. Create a "standard" exception class called ThirteenException. B. Write a program that repeatedly prompts the user to enter a string. After each string is entered the program outputs the length of the string, unless the length of the string is 13, in which case the ThirteenException is thrown with the message "Use thirteen letter words...
You are asked to build and test the following system using Java and the object-oriented concepts you learned in this course: Project (20 marks) CIT College of Information technology has students, faculty, courses and departments. You are asked to create a program to manage all these information's. Create a class CIT to represents the following: Array of Students, each student is represented by class Student. Array of Faculty, each faculty is represented by class Faculty. Array of Course, each course...
JAVA, please You must write a robust program meaning that your program should not crash with any given data. Data validation must be done any time that user enters an input. Write a program that 1. Gets an infix expression form the user and evaluate the expression using stack ADT a. Finds the postfix equivalent of the given infix expression b. Evaluate the created postfix expression. c. Note: your program should not crash when you enter an invalid expression such...
Java using data structures The objective is to create your own Hash Table class to hold a list of employees and their ID numbers. I've provided the TableEntry class which will be each data object in the hash table. The list of employees will be provided as a .txt file and must be read with the code. please create a .txt file called Employees.txt with the info provided so that the java code can read it in. Employees.txt: (No WhiteSpace...
JAVA - Please follow ALL instructions, thank you!! Here is the API, for a Point class representing a 2-dimensional point. https://docs.oracle.com/javase/7/docs/api/java/awt/Point.html Code an application class: 1.) (i.e., a class containing a main method), 2.) named PointApp that reads point data from the file points.text. This data is then used to create pairs of Point objects which are then used to flex (i.e, illustrate) the methods of the class. The format of the points.text file is: x1 y1 x2 y2 …...
C++ ONLY This is your first ever program using object oriented methodology. In this assignment you will need to instantiate (create) object(s) and invoke their member functions to perform different tasks. The program is to keep track of customer orders and to create reports as needed. At minimum you will need several objects to be instantiated throughout the program such as: An OrderProcessor object Order objects (stored in an array) Let’s get to class design now. Class Design class Order:...