1. Determine the first two lines of the new file created by the code below. This exercise refers to the file Justices.txt that contains data about the Supreme Court justices, past and present. Each record contains six fields – first name, last name, appointing president, home state, year appointed, and year they left the court. If they are still on the court, the last field is set to 0. The first two lines of the file are as follows: Samuel, Alito, George W. Bush, NJ, 2006, 0 Henry, Baldwin, Andrew Jackson, PA, 1844 Dim query = From line Int IO.File.ReadAllLines(“Justices.txt”) Let data = line.Split(“,”C) Let firstName = data(0) Let lastName = data(1) Let fullName = firstName & “ “ & lastName Let state = data(3) Select fullName & “’” & state IO.File.WriteAllLines(“NewFile.txt”, query) 2. Describe the new file created by the code. Dim query = From line In IO.File.ReadAllLines(“Justices.txt”) Let data = line.Split(“,”c) Let firstName = data(0) Let lastName = data(1) Let state = data(3) Let yrAppointed = CInt(data(4)) Let fullName = firstName & “ “ & lastName Let newLine = state & “, “ & fullName Where (yrAppointed >= 1990) And (yrAppointed < 2000) Order By yrAppointed Select newline IO.File.WriteAllLines(“NewFile.txt”, query)

1. The first two lines of the new file created by the code would be:

1. Samuel Alito ‘NJ’
2. Henry Baldwin ‘PA’

This code reads the contents of the file Justices.txt and parses each line into fields using the comma character as a delimiter. It then extracts the first name, last name, and state fields, and concatenates them into a full name using the “&” operator. Finally, it selects the full name and state concatenated with a comma and writes them to a new file called NewFile.txt.

2. The new file created by the code will contain the full name and state of Supreme Court justices who were appointed between 1990 and 2000, sorted by their year of appointment.

The code reads the contents of the file Justices.txt and splits each line into fields using the comma character. It then extracts the first name, last name, state, and year appointed fields, converting the year appointed field to an integer using the CInt function. Next, it concatenates the first name, last name, and state into a full name using the “&” operator, and concatenates the state and full name with a comma.

The code then filters the records to include only those justices who were appointed between 1990 and 2000, using the Where clause. It performs an ordering of the records based on the year appointed using the Order By clause. Finally, it selects the filtered and sorted records and writes them to a new file called NewFile.txt.

Therefore, the new file will contain a list of Supreme Court justices who were appointed between 1990 and 2000, sorted by their year of appointment. Each line in the file will consist of the state, followed by a comma and a space, and then the full name of the justice.

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