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

  What features look for switches and explain why want feature

You have been called in to consult on a new network design for CNT Books. The requirements of this design are summarized as follows: *The building has 3 floors. *There are 300 user workstations and 10 servers.

  Distinguish between baseband and broadband transmission

Distinguish in detail between baseband and broadband transmission?

  Write a program that reads in two floating-point numbers and

Write a program that reads in two floating-point numbers and tests whether they are the same up to two decimal places. here are two sample runs.

  Prepare database design documents using the data definition

Prepare database design documents using the data definition, data manipulation, and data control language components of the SQL language.

  Give time line which identify specific steps of installation

Give a time line, which identifies specific steps (including training) and related resources required to implement the recommended system.

  How many register window should be saved to memory as result

Assume two more calls are made after the maximum value from part (a) is reached. How many register windows must be saved to memory as a result?

  What might affect a spreadsheet developers choice

Excel allows you to display a system date using the date stamp and the NOW function. When might a date stamp be important? Why? What might affect a spreadsheet developer's choice for the date format used to display the date.

  Write a select statement that returns four columns

Write a SELECT statement that returns four columns: VendorName

  Write a program keeps an appointment calendar in database

Write a program that keeps an appointment calendar in a database.

  Excavated material to the structural fill location

How many dump truck loads, given a dump truck with 18 LCY capacity, will be required for hauling the excavated material to the structural fill location?

  What is the output of the following loop

What is the output of the following loop

  Use a traditional for loop to process the array

Write a Java method which takes an integer array parameter and fills the array with random numbers between 1 and 1000, including 1 and 1000. Use a traditional for loop to process the array.

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