Determine the output displayed when the button is clicked

Assignment Help Visual Basic Programming
Reference no: EM13809308

1. Determine the output displayed when the button is clicked.

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
‘Triple a number
Dim num As Double = 5
lstOutput.Items.Add(Triple(num))
lstOutput.Items.Add (num)
End Sub
Function Triple(ByVal x As Double) As Double
Dim num As Double = 3
Return num * x
End Function

2. Determine the output displayed when the button is clicked.

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim states, senators As Double
States = 50
Senators = 2
Senate(states * senators)
End Sub
Sub Senate (ByVal num as Double)
txtBox.Text = "the number of U.S. Senators is " & num
End Sub

3. Find the errors.

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim word As String, number As Double
word = "seven"
number = 7
Display (word, number)
End Sub
Sub Display(ByVal num As Double, ByVal term As String)
textOutput.Text = num & " " & term
End Sub

4. Rewrite the program so input, processing, and output are each performed by calls to Sub procedures.

Private Sub btnCompute_Click(...) Handles btnCompute.Click
‘Information about trees
Dim num As Integer = 7
Tree = "redwood"
ht = 362
lstBox.Items.Add("The tallest " & tree & " tree in the U. S, is " & ht & & " feet.")
tree = "pine"
ht = 223
lstBox.Items.Add("The tallest " & tree & " tree in the U. S. is " & ht & " feet.")
End Sub

5. Determine the output displayed when the button is clicked.

Private Sub btnDetermine_Click(...) Handles btnDetermine.Click
Dim word As String = ""
Dim num As Integer
GetFacts(word, num)
txtOutput.text = "The first " & num & " letters of " & word & " are " & BegOfWord(word, num) & "."
End Sub
Sub GetFacts(ByRef w As String, ByRef num As Integer)
w = InputBox("enter a word: ")
n = CInt(InputBox("Enter a number less than the length of the word: "))
End Sub
Function BefOfWiord(ByVal word As String, ByVal num As Integer) As String
Return word.Substring(0, num)
End Function
(Assume the two responses are Education and 3.)

6. Determine the output displayed when the button is clicked.

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim price, markdown, salesTax, finalCost as Double
InputData(price, finalCost)
finalCost = CostOfItem(price, markdown, salesTax)
DisplayOutput(price, finalCost)
End Sub
Sub InputData (ByRef price As Double, ByRef markdown As Double, ByRef salesTax As Double)
Price = CDbl(InputBox("Price of item: ")
Markdown = CDbl (InputBox("Percentage discount: "))
salesTax = CDbl(InputBox("Percentage state sales tax: "))
End Sub
Function CostOfItem(ByVal pr As Double, ByVal md As Double, ByVal st As Double) As Double
Dim reducedPrice, cost As Double
reducedPrice = pr - ((md/100) * pr)
cost = reducedPrice + ((st / 100) * reducedPrice)
Return cost
End Function
(Assume the three responses are 125, 20, and 6)

7. Identify the errors.

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim word As String
word = InputBox("What is your favorite word?")
txtOutput.Text = "When the word is written twice, " & _
Twice(word) & " letters are used."
End Sub
Function Twice(ByVal w As String) As Integer
'Compute twice the length of a string
Dim len As Integer
Return len = 2 * w.Length

End Function

Reference no: EM13809308

Questions Cloud

Evaluate the role of ethical decision-making in business org : Ethics, Compliance Auditing, and Emerging Issues Imagine that you have been tasked with creating a proposal for the new CEO of your organization for establishing an ethics program and for conducting training and compliance auditing. For this assignme..
Determine the output displayed when the button is clicked : Determine the output displayed when the button is clicked. Replace each phrase containing "Until" with an equivalent phrase containing "While", and vice versa. For instance, the phrase (Until sum = 100) would be replaced by (While sum 100)
Discuss the public policies that issue presidential powers : President Obama's use of presidential powers in the last 18 months. Identify and discuss the public policies that have been at issue using these presidential powers.
Significant capital constraints : In each of these scenarios, assume that firms do not face significant capital constraints.
Determine the output displayed when the button is clicked : Determine the output displayed when the button is clicked. Determine the output displayed when the button is clicked
Create the gui for a timekeeping or payroll system for cms : CMS Systems, Inc. is a company that provides information systems consulting services to companies in the telecom industry in the United States and the United Kingdom. create the GUI for a timekeeping/payroll system for CMS
Write a effective research about salt river in arizona : Write a effective research about Salt River in Arizona and how it is important to the phoenix area. what kind of events happens there and how people enjoy Salt River in Summer and history.
Four primary forecasting techniques : Differentiate at least two or three key elements for each of the four primary forecasting techniques and how they apply to your chosen organization.
Research and present the leading opinions and comment on the : PowerPoint presentation that examines a business issue of your choosing that has ethical implications.  For example, research the arguments (both for and against) regarding advertising to children, paying a living wage, requiring union membership, or..

Reviews

Write a Review

Visual Basic Programming Questions & Answers

  How to program in visual basic four square buttons

How to program in visual basic four square buttons arranged in a rectangular array each button says push me... when user clicks on a button the button disappears the other three come or remain visible

  The saffir-simpson hurricane wind scale classifies

The Saffir-Simpson hurricane wind scale classifies hurricanes into five categories based on the intensity of their sustained winds. A category one hurricane has wind speeds between 74 and 95 miles per hour (mph)

  Triangle of asterisks write a program that displays the

write a program that displays the following patterns separately one below the other in a textbox. use for...next loops

  Design a windows application for baseball ticket sales

Baseball ticket sales, design a windows application and write the code that will execute according to the program requirements, the chart and the use case definition.

  Need help building a vwd website

Need help building a VWD website. This website may not go live. I have little progress as a family tragedy has impeded my time for school.

  Write a multiform program

Airplane Seating Chart An airplane has 15 rows (numbered 1 through 15), with six seats (labeled A, B, C, D, E, and F) in each row. Write a multiform program that keeps track of the seats that have been reserved and the type of meal requested by ea..

  Juke box created in visual studios

I need a Juke Box Created in Visual Studios 2010. The code should be done in Visual Basic.

  Arrays write a program using dynamic arrays to record the

write a program using dynamic arrays to record the high temperatures of last ltbrgtseven days and to display all of

  Design a logic for a program

Design a logic for a program that allows a user to enter 15 numbers, then displays each number and its difference from the numeric average of the numbers entered.

  Showing data from black friday sales including cost

I need a vb application in Microsoft Visual Studio showing data from black friday sales including cost, sales prices, transportation fees, profits, losses, best selling list, and worst selling list

  Miles per gallon applicationdrivers are concerned with the

miles per gallon applicationdrivers are concerned with the mileage obtained by their automobiles. one driver has kept

  Technical project designing vb applications across multiple

technical project designing vb applications across multiple platformsthis assignment will contain two 2 parts written

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