Find the output displayed when the button is clicked

Assignment Help Programming Languages
Reference no: EM13751553

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: EM13751553

Questions Cloud

Why the health status of the country plays an important role : List and explain reasons why the health status of the country plays an important role in its ecomic status
What groups resisted absolutism : What groups resisted absolutism? How and why did they resist? What English traditions and political ideas prevented the adoption of absolutism?
How it is possible to break wired equivalent privacy : One page describing how it is possible to break Wired Equivalent Privacy (WEP). also write summery discussion for more interaction on the subject
Multinational financial management : From the e-Activity, determine key reasons why a multinational corporation might decide to borrow in a country such as Brazil, where interest rates are high, rather than in a country like Switzerland, where interest rates are low. Provide support ..
Find the output displayed when the button is clicked : Determine the output displayed when the button is clicked
How currents events changes your perspective on the world : Explain how currents events changes your outlook or perspective on the world , with everything that's going on.
Acquisition opportunities to gain market share : In today's uncertain economic and regulatory environment for the health services industry, many organizations may be presented with merger and acquisition opportunities to gain market share and drive financial and operational efficiencies. Given t..
Developing research analysis skills : The purpose of the annotated bibliography is to assist you in developing research analysis skills including critical thinking, writing, and literature research skills. The annotated bibliography should include a paragraph for each source containin..
Discuss issues and concerns about use of portable devices : Security and Mobile Devices: Discuss issues and concerns about the use of portable devices such as tablets, smart phones and laptops

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a prolog relation remove

Write a Prolog relation remove(E,L,R) that is true if R is the list which results from removing one instance of E from list L. The relation is false if E isn't a member of L.

  Function to count number of times the given number occured

Write a main function to input 20 integers in the range of 1 to 6. Write a function to count the number of times the numbers 2 and 5 occur. The function should declare static variables count2 and count5.

  Write program for user to perform arithmetic operations

Write a program that lets the user perform arithmetic operations on fractions. Fractions are of the form a/b, where a and b are integers and b is not equal to 0.

  Create a script file that generates a row vector

Create a script file that generates a row vector of 10 random numbers from 5 to 15 - Call your function using your array of random numbers and the scalar value of 22.

  Explain circumstances in which we can implement array

If you were describing the array to friend who is learning Java, how would you do so? Explain circumstances in which you could implement the array.

  Program to compute person earns in a month

Write a program that calculates how much a person earns in a month if the salary is one penny the first day, two pennies the second day, four pennies the third day.

  Write modular program to enter integers for sorting

Write a modular program that performs the following functions: Allows the user to enter 10 integers for sorting, Allows the user to select one of the two types of sorting techniques.

  Write the program which approximates pi using series

Your problem is to write the program which approximates pi using above series. Allow the user to specify the number, n, of terms to be used.

  Draw diagram shows occupancy of buffer as function of time

A transmitter with rate R bps serves the buffer by sending the bits whenever available. Draw a diagram that shows the occupancy of the buffer as a function of time, for different ranges of values for R.

  Develop project to calculate checking account balance

Develop project to calculate your checking account balance. Form: Include radio buttons to indicate the type of transaction: deposit, check, or service charge.

  Identify all the pure-strategy nash equilibria of game

Identify all of the pure-strategy Nash Equilibria of this game. Identify at least one mixed-strategy Nash Equilibrium, and show that it is a Nash Equilibrium.

  Prepare a program that takes the data from triangle

Prepare a program that takes the data from triangle.txt (supplied in this folder) and outputs a message indicating whether the triangle is a right triangle. The text file has data for three triangles.

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