One of the fundamental requirements of programs is to use data stored, writing homework help

Anonymous
timer Asked: Aug 17th, 2017
account_balance_wallet $15

Question Description

One of the fundamental requirements of programs is to use data stored

in permanent storage such as a hard disk file. Programs must be able to

read and write this type of data and use appropriate data structures

within the program to work with the data. In this assignment, you will

write a program to load and manipulate a data file. The data file can be

downloaded from the following link: Unit 4 Sample Data.

The file should not be a comma delimited file and should have the following record structure:

  • FirstName – Character – Size (12)
  • LastName – Character – Size (16)
  • Company – Character – Size (32)
  • Address – Character – Size (32)
  • City – Character – Size (24)
  • County – Character – Size (24)
  • State – Character – Size (2)
  • ZIP – Number – Size (5)
  • Phone – Character – Size (12)
  • Fax – Character – Size (12)
  • Email – Character – Size (32)
  • Web – Character – Size (42)

Step 1: For this assignment, you will write a complete Java console program to load the data file into an ArrayList data structure. Store each line from the file as a separate record in the ArrayList. To read the file, you should use a FileReader wrapped in a BufferedReader. If you create a Java class to contain each record, you will be able to create an object for each record and store the object in the ArrayList. Sorting the data can then be done using another wrapper class that contains the ArrayList and has methods for sorting and output of the data.

Step 2: After the file is loaded into the ArrayList, sort the data in ascending order based on the LastName field, and display the following fields:

  • First name
  • Last name
  • Company

Step 3: Next, sort the data in descending order based on the ZIP field, and display the following fields:

  • First name
  • Last name
  • Company
  • ZIP

Step 4: Display all of the records (and all of the fields) for everyone that is in the state "NY."

Step 5: The submission should be a single MS Word document with the program source code for the solution and screenshots of the output for the following list:

  1. Sorted data based on last name
  2. Sorted data based on ZIP
  3. Everyone in the state of NY

Tutor Answer

DrCS
School: UT Austin

Hi,Your homework is done. Please find the attached doc and the zip folder

Code:
Person class:
public class Person {
private String firstName;
private String lastName;
private String company;
private String address;
private String city;
private String county;
private String state;
private String zip;
private String phone;
private String fax;
private String email;
private String web;
public Person(){
}
public Person(String firstName, String lastName, String company, String
address, String city, String county,
String state, String zip, String phone, String fax, String email,
String web) {
this.firstName = firstName;
this.lastName = lastName;
this.company = company;
this.address = address;
this.city = city;
this.county = county;
this.state = state;
this.zip = zip;
this.phone = phone;
this.fax = fax;
this.email = email;
this.web = web;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;

}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
...

flag Report DMCA
Review

Anonymous
Good stuff. Would use again.

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors