Write a program to find the largest of five numbers

Assignment Help Programming Languages
Reference no: EM13780121

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

Questions Cloud

Considered a common purpose of advertising : All of the following are considered a common purpose of advertising except: According to the article Toyota Sales USA, one of the driving forces in Toyota’s target market component of their 2003 ad campaign was: The four basic factors that are most i..
Feature of romantic art and music : Passionate nationalism, like Tchaikovsky's for Russia, could be a feature of Romantic art and music and in the arts of the late 1800s. Give primary examples of music today (besides national anthems) that is characterized by nationalism.
Discuss payments options and discuss the pros and cons : Compare and contrast three (3) payments options and discuss the pros and cons of each. Examine the three (3) elements of the Prompt Payment Act, and provide one (1) example of each
Trade, retail, telemarketing, and e-marketing issues : What are three sales promotion strategies? Compare and contrast the three strategies and use one product to illustrate each strategy.
Write a program to find the largest of five numbers : 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).
Regarding protected group employees : Write a two to three page paper responding to the following questions regarding protected group employees: Who are classified as protected group employees? In what ways must these employees be treated differently than non-protected group employees?
Liability in sexual harassment cases : What recommendations would you make to help large organizations minimize their liability in sexual harassment cases?
Group influence the individual in a positive manner : Primary Task Response: Within the Discussion Board area, write 400-600 words that respond to the following questions with your thoughts, ideas, and comments. This will be the foundation for future discussions by your classmates. Be substantive and..
Determine the labor productivity of the widow fans : The cool-Tech company produces various types of fans. In may, the company produced 1728 window fans at a standard rice of $40. The company has 12 direct labor employees. During May Window fans were produced on 9 working days (of 8 hours each), and ot..

Reviews

Write a Review

Programming Languages Questions & Answers

  Create the application class using appropriate application

Test the class by placing the hard coded data into the driver class, which then instantiates your class and calls its instance method. Pass the hard coded data into the constructor and/or method.

  Pseudocode program by multiplying the length by the width

An area is calculated by multiplying the length by the width. The pseudocode program below shouldask the user for the length and width of a rectangular room in order to calculate the area, and displaythe room's area. Will it do the job.

  Design and implement program catches and handles exception

Design and implement a program that creates an exception class called StringTooLongException, designed to be thrown when a string is discovered that has too many characters in it.

  Program to accept mass-density and compute volume

Write down the program which accepts as input the mass (in grames) and density (in grams per cubic centimeters), and output volume of the object.

  Program to create three identical list

Write a program to create three identical list, list1, list2, and list3, of 5000 elements. The program then sorts list1using quick sort, list 2 using insertion sort.

  Determine seperate total of positive and negative numbers

Read set of 40 positive and negative numbers entered from keyboard and determine seperate total of positive and negative numbers. How to show modular design of above statement

  Ms word versus other processing program

MS word Versus other processing program

  Do the second half as a completely separate loop

Do the second half as a completely separate loop. Remember you'll print out "n" number of stars on a line the same way whether you are doing the top half or the bottom half

  You have been tasked with building a payroll program for a

you have been tasked with building a payroll program for a large organization with offices spread across the united

  Explain encapsulation of data and methods

Explain the following three key concepts of object-oriented technology. Illustrate each one using examples. a) Encapsulation of data and methods b) Support for polymorphism c) Inheritance within class hierarchies.

  Write a program that calculates a cars gas mileage

Write a program that calculates a car's gas mileage - The program should ask the user to enter the number of gallons of gas the car hold and the number of miles it can be driven on a full tank.

  Wysiwyg editors can be used to learn html

What about fact that WYSIWYG editors can be utilized to learn HTML? As you can usually jump back and forth from their own image.

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