Step 1: Given a file of data, read the data and parse it based on a fixed given
ID: 3785480 • Letter: S
Question
Step 1: 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: Unit 4 Sample Data. The file should not be a comma delimited file with 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 2: 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. Step 3: 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 4: Next, sort the data in descending order based on the ZIP field, and display the following fields: First name Last name Company ZIP Step 5: Display all the records (and all its fields) for everyone that is in the state "NY." Step 6: Submit the source code for the solution and the output screenshots for the following list. You can use any appropriate algorithm in the solution. Sorted data based on last name Sorted data based on ZIP Everyone in the state of NY
This question has been answered. But it does not work in C#. Please show and explain how to do the sorting of the data presented.
Explanation / Answer
class CustomersInfo
Declare string FirstName, LastName , Company , Address , City, Zip , State , County , Fax , Phone , email , web , phone , Email , Web
Module main
ArrayList persons = new ArrayList()
OPEN File ("ITCO321_U4IP_sample_data.csv")
while (!File.hasData)
Declare string line = File.ReadLine()
Declare string [] fields = line.Split(',')
create a new customer object p using fields
persons.Add(p)
END While
DISPLAY("Print First name, last name, company Sorted by last name")
SortLastName(persons)
DISPLAY("Print First name, last name, company, zip code sorted by zip code in descending order")
SortZipCode(persons)//call function to sort according to zip code
DISPLAY("Print all records of states NY")
PrintAllRecords(persons)
Console.ReadLine()
END MAIN
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.