Write lines of code as instructed in steps

Assignment Help Basic Computer Science
Reference no: EM13499045

Write lines of code as instructed in Steps (a) through (e) to fill in the missing lines in the following program:

Structure Appearance

Dim height As Double 'inches

Dim weight As Double 'pounds

End Structure

Structure Person

Dim name As String

Dim stats As Appearance

End Structure

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

Dim person1, Person2 As Person

a. (a) Give person1 the name Michael

b. (b) Set Michael's height and weight to 71 and 190, respectively

c. (c) Give person2 the name Jacob

d. (d) Set Jacob's height and weight to 70 and 175, respectively

e. (e) If one person is both taller and heavier than the other, display a sentence of the form

"[name of bigger person] is bigger than [name of smaller person]."
In exercises 15 through 18 describe the output that results from clicking on the button. The programs use the file Cities.txt that contains information about the 25 largest cities in the United States. Each record of the file has four fields - name, state, population in 2000 (in 100,000s), and population in 2010 (in 100,000s). The first four lines in the file are as follows:


New York, NY,80.1,82.7
Los Angeles,CA,36.9,38.84
Chicago,IL,29.0,28.7
Houston,TX,19.5,22.4


Assume that each program contains the following code:
Structure City
Dim name As String
Dim state As String
Dim pop2000 As Double
Dim pop2010 As Double
End Structure


Dim cities() As City


Private Sub frmCities_Load(...) Handles Me.Load
'Place the data for eaech city into the array cities
Dim cityRecords() = IO.File.ReadAllLines("Cities.txt")
'Use the array cityRecords to populate the array cities.
Dim n = cityRecords.Count = 1


ReDim cities(n)
Dim line As String 'holds data for a single city
Dim data() As String
For i As Integer = 0 to n
line = cityRecords(i)
data = line.Split(","c)
cities(i).name = data(0)
cities(i).state = data(1)
cities(i).pop2000 = CDbl(data(2))
cities(i).pop2010 = CDbl(data(3))
Next
End Sub


HERE ARE THE QUESTIONS!


16. Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
dim query = From cty In Cities
Where city.state = "TX"
Let growth = (cty.pop2010 - cty.pop2000) / cty.pop2000
Order By Growth Descending
Select cty.name, cty.state, growth
For Each cty In query
1stOutput.Items.Add(cty.name & ", " & cty.state)
Next
1stOutput.Items.Add("Greatest growth: " &
FormatPercent (query.First.growth))
End Sub






18. Private Sub btnDisplay_Click(...) Handles btn.Display.Click
Dim query = From cty In cities
Order by cty.pop2010 Descending
Select cty.pop2010
Dim pops() As Double = query.toArray
ReDim Preserve pops(9)
txtOutput.Text = FormatNumber(100000 * pops.Sum, 0)
End Sub

Reference no: EM13499045

Questions Cloud

Explain how do you find the mass of a stable isotope : How do you find the mass of a stable isotope where the percentage is given as well as the average atomic weight of a certain element
Compute pension expense : Compute the same items as in (a), assuming that the settlement rate is now 7% and the expected rate of return is 10%.
Evaluate the volume of this alloy that can be made : A gold alloy has a density of 12.4g/ml and contains 75%gold by mass. calculate the volume of this alloy that can be made from 255 g of pure gold.
Estimate mercers share price at the conclusion of : Mercer Corp. is an all equity firm with 10 million shares outstanding and $100 million worth of debt outstanding. Its current share price is $75. Mercer’s equity cost of capital is 8.5%. Mercer has just announced that it will issue $350 million worth..
Write lines of code as instructed in steps : Write lines of code as instructed in Steps
Explain oxidation reactions and halogenation reactions : You should practice writing valid (balanced equations) for alkanes -- oxidation reactions (combustion reactions with O2) and halogenation reactions (reactions with halogen gasses, such as Br2).
Compare and contrast the role of the leader vs the manager : Compare and contrast the role of the leader vs. the manager in creating an agenda and developing the human resources system to achieve the agenda. Make sure to illustrate how both functions work together to achieve an outcome.
Depict the structures of the possible constitutional isomers : Restricting yourself to straight-chain (unbranched) compounds, draw the structures of the possible constitutional isomers of pentene. There are two "variables" -- the position of the double bond; and cis/trans isomerization at that double bond.
Generate a set of input test values : Generate a set of input test values.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Design the static method below to count

Design the static method below to count and return the frequency of each digit in the array of strings.

  Draw the uml diagram and implement

Draw the UML diagram and implement the new GeometricObject class. Write a test program that uses the max method to find the larger of two circles and the larger of two rectangles.

  Use a block diagram for the decoder

Implement the circuit with a 3x8 decoder and OR gates. Use a block diagram for the decoder.

  Explaining downtick in project success rates of it projects

What is the likely reason or reasons for the downtick in project success rates of IT projects and what recommendations would you make to improve the success rates? Be specific.

  Use the mvc design pattern to create a gui program

Use the MVC design pattern to create a GUI program for Triangle objects. Include a form for users to enter values for a triangle;s three sides and a button that when clicked, displays data from the Triangle object created from the input.

  Explaining database system of facebook and google

Does Facebook and Google use same database system? Facebook seems to run with the android platform using gmail address to retain information for user such as phone numbers and contacts.

  What are the primary tasks of a system administrator

what are the primary tasks of a system administrator? 2. What does each task accomplish

  Explaining ethical issues related to it

Ethics is "a set of principles of right conduct". Main ethical issues related to IT are accuracy, privacy,  property (including intellectual property), and accessibility to information.

  Input function to prompt the user to enter a square

In the script file, use the input function to prompt the user to enter a square 2-dimensional array. Use a loop to check that user's input is a square array and repeatedly ask the user to enter a square array until they enter a square array (you m..

  Websites be required to adhere to section standards

what is the purpose then? Do you think that all websites should be required to adhere to Section 508 standards? Why or why not?

  Problem of traveling from one city to another

Describe how the problem of traveling from one city to another could be framed as a production system. What are the states? What are the productions?

  How dui charges of domestic violence and influence career

Sensitive information and may end up in court as technical or expert witness. How can things like a DUI, charges of domestic violence and other items influence your career?

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