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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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