Given a file of data, read the data and parse it based on a fixed given field headers. To download the file, select the following link: Eliminate the last column (Pig-Latin) in the data file. The file is a comma delimited file with the following record structure: Write a complete C# program in console mode to load the data file as a sequential file using C# System.IO library into an ArrayList data structure (using the System.Collection library) Store each line in the file as a separate record. After the file is loaded into the ArrayList, sort the data in ascending order based on the LastName field and Display the following fields: Next, sort the data in descending order based on the ZIP field, and display the following fields: Display all the records (and all its fields) for everyone that is in the state “NY.” Submit the source code for the solution and the output screenshots for the following list. You can use any appropriate algorithm in the solution.

Task: Reading and Parsing Data from a File in C#

In this assignment, the goal is to write a C# program that reads and parses data from a given file based on fixed field headers. The file can be downloaded using the provided link. The program should eliminate the last column (Pig-Latin) in the data file.

The file is a comma-delimited file with a specific record structure. To accomplish this task, we will utilize the C# System.IO library to load the data file as a sequential file into an ArrayList data structure from the System.Collection library. Each line in the file will be treated as a separate record.

Once the file is loaded into the ArrayList, we will sort the data in ascending order based on the LastName field and display specific fields. Next, we will sort the data in descending order based on the ZIP field and display the same specific fields.

Additionally, we need to display all records and their fields for individuals located in the state “NY.” The solution should provide the source code and output screenshots for the requested lists.

To achieve this, we can follow the following steps:

1. Download the data file using the provided link.
2. Create a C# console application and import the required libraries: System.IO and System.Collections.
3. Load the data file using the FileStream and StreamReader classes from the System.IO library. Open the file in read mode.
4. Initialize an ArrayList to store the records.
5. Read each line of the file using the StreamReader.ReadLine() method and add it as a separate record to the ArrayList.
6. Close the StreamReader once all records have been read.
7. Remove the last column (Pig-Latin) from each record in the ArrayList. This can be done by splitting each record with the comma delimiter and removing the last element.
8. Sort the ArrayList in ascending order based on the LastName field. This can be achieved by implementing a custom comparer class and using the ArrayList.Sort() method.
9. Display the required fields from each record in the sorted ArrayList.
10. Sort the ArrayList in descending order based on the ZIP field, following the same process as in step 8.
11. Display the required fields from each record in the descending sorted ArrayList.
12. Filter the ArrayList to only include records where the state field is “NY.”
13. Display all fields for each record that meets the filtering criteria.

By following the above steps, we can create a C# console program to read, parse, sort, and display the requested information from the given data file.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer