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

  Textbook ordering system deployment diagram

System architects and analysts use unified modeling language (UML) deployment diagrams to model the configuration of the hardware and software components of a system and how they will be deployed in a production environment. In other words, dep..

  Evaluate five to seven most important things about computer

Evaluate five to seven most important things about computer network

  The sum of the first even integers true or false

The sum of the first 17 even integers is 306. True or False Answer

  Describe the meaning of the resource

Describe the meaning of the subsequent two Resource Records:

  How a virtual address in this machine is translated

how a virtual address in this machine is translated into a physical address, assuming that the MMU has an 8-entry fully associative TLB. Label all lines and show how many bits are in each part.

  Is imageholder and picturebox are similar controls

ImageHolder and PictureBox are similar controls. Do you agree? Why or why not?

  Illustrate how to overload the operators

Use the class rectangletype to illustrate how to overload the operators

  Acilisis, lacinia, curabitur egestas

Acilisis, lacinia, curabitur egestas, lorem, risus. Class Ac amet laoreet parturient, quam justo interdum hendrerit erat faucibus, facilisi scelerisque commodo, odio. Ligula conubia potenti, per praesent est egestas felis a facilisis potenti vehicula..

  The envirofacts data warehouse

The Envirofacts Data Warehouse

  Distribute music on the internet.

an architecture for a system (such as iTunes) that is used to sell and distribute music on the Internet. What architectural patterns did you use as the basis for this architecture? Why are these patterns appropriate?

  Code skeleton to declare a class named date

Complete the following code skeleton to declare a class named Date. The class should contain variables and functions to store and retrieve a data in the form 4/2/2012.

  Write an arm assembly function

Write an ARM assembly function that takes a string and two characters and returns a pointer to a new modified string. The first character is the character to replace and the second is the character to replace it with. The C program below changes t..

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