Write a program that uses the xml file from par

Assignment Help Basic Computer Science
Reference no: EM13776201

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)

3. Determine the output displayed in the text box when the button is clicked.

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

Dim salutation, welcome As String

Dim sw As IO.StreamWriter = IO.File.CreateText("Greetings.txt")

sw.WriteLine("Hello")

sw.WriteLine("Aloha")

sw.Close()

Dim sr As IO.StreamReader = IO.File.OpenText("Greetings.txt")

salutation = sr.Readline

welcome = sr.Readline

sr.Close()

txtOutput.Text = welcome

End Sub

4. Identify any errors. Assume that the contents of the Greetings.txt file are:

Hello

Aloha

Bon Jour

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

Dim name, greeting As String

Dim sr As IO.StreamReader = IO.File.OpentText("Greetings.txt")

name = "NewGreet.txt"

Dim sw As IO.StreamWriter = IO.CreateText("name")

Do Until sr.EndOfStream

greeting = sr.Readline

sw.Writeline(greeting)

Loop

sr.Close()

sw.Close()

End Sub

5. The first two lines of the file AgetAtInaug.txt are

George Washington, 57

John Adams, 61

whereeach record has two fields - name of president and his age when inaugurated. Create an XML file containing these two records

6. The CSV file Senate.txt contains a record for each member of the 111th U.S. Senate. (The 111th U. S. Senate was installed in 2009.) Each record contains three fields - name, state, and party affiliation. Some records in the files are

John McCain, Arizona, R

Joseph Lieberman, Connecticut, I

Kirsten Gillibrand, New York, D

(a) Write a program that uses the file Senate111.txt and creates an XML file containing the same information.

(b) Write a program that uses the XML file from par (a) to display the names, states, and party affiliation of all the senators in the DataGridView in order by state. The two senators from each state should be in order by their first names.

Reference no: EM13776201

Questions Cloud

Describe personality and social development : Write a 1,050- to 1,400-word report in which you describe personality and social development in later adulthood to the potential client's family.
Examining human service interactions : Write a 1,050- to 1,400-word paper examining human service interactions in terms of macro systems-communities and organizations.
Write an essay on tomboy : Write an essay on Tomboy.
Individual paper on personal values and ethical standards : Prepare a 1000 to 1400 word paper on the development of your personal values, ground rules, and ethics. Focus on the developmental aspect rather than on a particular position on any issue.
Write a program that uses the xml file from par : Write a program that uses the XML file from par (a) to display the names, states, and party affiliation of all the senators in the DataGridView in order by state. The two senators from each state should be in order by their first names.
Decision rendered by the hearing officer : Which of the following does not result in a decision rendered by the hearing officer
Human service professional : Describe a situation you may find yourself, as a human service professional, where your personal values could become an ethical issue.
How language and literacy can have a significant impacts : In this section of the class, we will read several essays about how language and literacy can have a significant impact on how we see ourselves and the world around us.
What are the major responsibilities of state fire marshals : What are the major responsibilities of state fire marshals? Why is this role significant in statewide fire prevention, investigation, enforcement, and fire safety

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Functions involving double hash on c++

Functions involving double hash on c++

  What is a hash value

What is a hash value, and why do you think it is important?

  Prepare design proposal for new office network

Callingyou Inc is a growing company providing 24-7 telephone support services for numerous companies. They have asked you to prepare a design proposal for their new office network.

  List and discuss five areas where threat to data security

List and discuss five areas where threat to data security might occur? 4. Briefly describe the major components of a datawarehouse architecture.

  Benefits-negative effects brought by workplace automation

Write down at least three benefits and three negative effects brought about by workplace automation.

  Level-order traversal of the red-black bst

What is the level-order traversal of the red-black BST that results after inserting the following sequence of keys:

  What is the approximate limit of ram

Your computer at work is running a 32-bit version of Windows XP. What is the approximate limit of RAM your machine can effectively use?

  Write general set of instructions will allow us to change

Write a general set of instructions that will allow us to change any displayed value (from 0 to 9) to any desired value (from 0 to 9) in the least number of steps. For example, if the displayed value is 1 and the desired value is 0,

  Converting from fahrenheit to celsius

Converting from Fahrenheit to Celsius, Create a Memo using the Memo Template for each of the tasks. The document should contain

  Modify the payroll program

Modify the Payroll Program so that it uses a class to store and retrieve the employee's name, the hourly rate, and the number of hours worked. Use a constructor to initialize the employee information

  Design and code a project to calculate the amount due

Design and code a project to calculate the amount due for rentals. Movies may be in VHS(videotape) format or DVD format. Videotapes rent for $1.80 each and DVDs rent for $2.50.

  How many members of the group like all parties

while two dislike the Liberals, NDP, and Green Party; three dislike the Conservatives, New Democrats, and Greens; and four dislike the Conservatives, Liberals, and Greens. Two people dislike all four parties. How many members of the group like all..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd