Write a program to find the largest of five numbers

Assignment Help Programming Languages
Reference no: EM13751138

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

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

Dim num As Double = 0

Dim max As Double = -1

Dim prompt As String = " Enter a nonnegative number. " & Enter -1 to terminate entering numbers."

Num = CDbl(Input Box(prompt))

Do While num >= 0

If num > max Then

Max = num

End If

Num = CDbl(InputBox(prompt))

Loop

If max <> -1 Then

MessageBox.Show("Maximum number: " & max)

Else

MessageBox.Show("No numbers were entered.")

End If

Assu;me that the responses are 4, 7, 3, and -1)

2. 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).

While (ans = "Y") And (n < 7)

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

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

Dim word As String = "courage"

Dim letter As String = ""

Dim numVowels As Integer = 0

For i As Integer = 0 To word.length - 1

Letter = word.Substring(I, 1)

If IsVowel (letter) Then

numVowels += 1

End If

Next

txtBox.Text = CStr(numVowels)

End Sub

Function IsVowel(ByVal letter As String) As Boolean

Letter = letter.ToUpper

If (letter = "A" Or (letter = "E") Or (letter = "I") Or (letter = "O") Or (letter = "U") Then

Return True

Else

Return False

End If

End Function

4. Rewrite the program using a For...Next loop.

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

Dim num as Integer = 1

Do While num <= 9

lstBox.Items.Add(num)

num += 2

Loop

End Sub

5. Identify the errors.

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

‘Display all numbers from 0 through 20 except for 13

For i As Integer = 20 to 0

If i = 13 Then

i = 12

End If

Next

End Sub

(Assume that the five lines of the file DATA.TXT contain the following entries: 3, 2, 4, 7, 2.)

6. Determine the contents of the text box after the code is executed.

Private Sub btnDisplay_Click(...) Handles btnDisplay.Click

Dim total As Integer = 0

For n As Integer = 0 To lstBox.Items.Count - 1

If CStr(lstBox.Items(n)).Length = 6 Then

Total += 1

End If

Next

txtOutput.Text = CStr(total)

End Sub

7. Write a program to find the largest of five numbers obtained from the user with an input dialog box.

Reference no: EM13751138

Questions Cloud

Earning zero economic profits : The firms in a perfectly competitive industry had been earning zero economic profits.  However, the firms have recently experienced a large decrease in the cost of energy that enables them to substantially reduce the marginal cost and average total c..
What is the opportunity cost of attending college : According to economic growth theory, the level of the GDP and the rate of the real GDP growth rate have different economic implications about the economic well-being of a country.
Describe your role as an employee of an organization : Briefly describe your role as an employee of an organization in the IS field. Give examples of what you need to know about information systems and how it can help with your job performance
Evaluate the management of inventories and resources : Employ the concept of capacity management. Evaluate the management of inventories and resources. Use technology and information resources to research issues in operations management.
Write a program to find the largest of five numbers : Write a program to find the largest of five numbers obtained from the user with an input dialog box
Illustrate using a fully labeled supply and demand graph : What is the equilibrium wage and explain what the results of such a move are for the graham cracker market. In other words, will there be a SHORTAGE, a SURPLUS, or neither created? Why?
How much compensation will m receive : c) Assuming the two different prices for S, how much of the two goods will be produced if Fnch has the right to pollute? "the firms are not merged" d) Assuming the two different prices for S , how much of the two goods will be produced if M has the r..
Create a system wide clinical documentation program : Write a 2 page report (paper) on your plan to create and implement a system wide clinical documentation program at your organization
What is the rate of return : Suppose you purchase a coupon bond with 20 years to maturity for $1,000. Assume the bondpays coupons of $70 per year.a. Suppose after one year you must sell the bond to help pay for tuition. Assume further thatinterest rates have risen so that the pr..

Reviews

Write a Review

Programming Languages Questions & Answers

  Write program which translate letter grade into number grade

Write program which translates a letter grade into number grade. Letter grades are A, B, C, D, F, possibly followed by + or -.

  Prepare calculator application - mock objects for testing

Which other classes do you think will need to be stubbed with mock objects for testing the application? For each class you identify explain why you think that class needs mocking and at least three di erent mocked behaviours you will need.

  Advantages of contemporary languages allow kinds of comments

Many contemporary languages allow two kinds of comments, one in which delimiters are used on both ends (for multiple line comments), and one in which a delimiter marks only the beginning of the comment.

  Designing the site links

Company needs to be able to schedule the time of day when the connections are available for replication. Replication should not occur during peak business hours. When designing the site links, which of the following options should you use?

  Activity for pdus on project management institute-s web site

Several activity categories are given as qualifying for PDUs on project Management Institute's Web site. Recognize  these categories. In which categories would you place Chris's experience?

  Write java program which declares the array alpha

Write the Java program which declares the array alpha of 50 elements. Initialize array so that first 25 elements are equal to square of the index variable and the last 25 elements

  Write a program which defines an integer array of size

Write a program which defines an integer array of size three (3), the size of the array should be a constant variable. Read data using loops for this array from the user. The data of this array will be the number of vacation days of an employee in..

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write program to list all english-math and science teachers

Suppose that input consists of a file of teachers. You are told to write a program to list all English, math, and science teachers. Each teacher can teach only one subject.

  How many time is loop body of while statement executed

How many time is the loop body of the while statement executed? a) once, b) never, c) 49 times, d) 50 times, e) until a number 50 or larger is entered

  Write vl program to convert leagues-number of nautical miles

Write a VL program which will convert 20,000 leagues to number of nautical miles. Your program requires no input elements, just elements to compute result and output how many nautical miles is equivalent to 20,000 leagues.

  Write pseudo code to put scores until e button is hit

The program will keep on prompting you to put more scores until you hit E button on your keyboard. Write one page statement to examine this problem.

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