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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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