Rewrite the program so input processing

Assignment Help Programming Languages
Reference no: EM13781239

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

Reference no: EM13781239

Questions Cloud

Defines a word term or concept in depth : A definition essay defines a word, term, or concept in depth by providing a personal commentary on what the specific subject means.
Explain the principal-agent problem as it pertains to equity : Explain the principal-agent problem as it pertains to equity contracts.
Business requirements document and a project plan : Write clearly and concisely about strategic issues and practices in the information systems domain using proper writing mechanics and technical style conventions.
Devise a hypothetical business situation : Devise a hypothetical business situation in which buying a lookback call option on a commodity may be a sound strategy for you. How about a down-and-out call option
Rewrite the program so input processing : Determine the output displayed when the button is clicked. Determine the output displayed when the button is clicked.
Quantitative and qualitative approaches : Chooses between quantitative and qualitative approaches that you would use to study the problem and discuss which design you would use and why.
Sarbanes-oxley act of 2002 issues : What do strategic managers call a flow of information through interrelated stages of analysis toward the achievement of an aim?
Describe how changes in technology contributed : Describe how changes in technology contributed to the globalization of markets - Explain how the Internet affects international business activity and the globalization of the world economy.
Ilab overview : you will develop a policy statement and the processes and procedures that can be used to drive the design, implementation, and maintenance of a wireless network in a SOHO (small office, home office) setting.

Reviews

Write a Review

Programming Languages Questions & Answers

  Application to feature a gui

A program written in Dr. Racket Scheme that makes use of lists, higher order procedures (e.g. map, filter, reduce) and/or recursion. If all of those could be used it would be best

  Program to divide string based on some delimiter string

StringTokenizer is a class in the java.util library that can divide a String based on some delimiter String (a delimiter is a separator). If the instruction StringTokener st = new StringTokenizer.

  Write function concatenation of two strings as its input

Assume f is function which returns result of reversing string of symbols given as its input, and g is function which returns concatenation of two strings given as its input.

  Find out the total of balances

Display all the contents of the file in a tabular format with the first row being a header row and write to a file that is called account numbers.txt only the account numbers from the read file.

  Write a perl program

Write perl program which will run on my system and will start another perl program on another linux system. The main program should wait for linux perl program to complete its work and send the result to my main perl program.

  Determine the output of the given program what will happen

question what is the output of the following program?class exception2 public static void mainstring args

  Write program to enter current value of car

Write a program that asks the user to enter the current value of a car. For a new car, it is the selling price of the car. The program should display the number of years it takes for the car's trade-in value to be below $1000.

  Html5 assignment i need an assignment for html5 containing

i need an assignment for html5 containing 2 parts1 3 pages html5 website2 report more important than the website

  Write a prolog relation that returns a list

Write another relation (anything you want) that does something not performed above. Explain what your relation does.

  Correspondence between a grammar and a type

Identity the correspondence between a grammar and a type and identify the correspondence between a grammar and a recursive-descent parser.

  Program to prompt the user for an arithmetic choice

The main menu of your program is to continue to prompt the user for an arithmetic choice until the user enters a sentinel value to quit the calculator program.

  Write progam which uses two-dimensional array

Write the progam which uses two-dimensional array to store the highest and lowest temperatures for each month of the year. The program should output the average high, average low,

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