Determine the output displayed in the text box

Assignment Help Visual Basic Programming
Reference no: EM13811133

1. Determine whether the condition is true or false. Assume a = 2 and b = 3.
((a = b) Or Not (b < a)) And ((a < b) Or (b = a + 1))

2. Determine whether or not the two conditions are equivalent - that is, whether they will be true or false for exactly the same values of the variables appearing in them.
Not ((a = b) Or (a = c)); (a <> b) And (a <> c)

3. Determine the output displayed in the text box when the button is clicked. Assume the response is B
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim letter As String
letter = InputBox("Enter A, B, or C.")
letter = letter.ToUpper
If letter = "A" Then
txtOutput.Text = "A, my name is Alice."
ElseIf letter = "B" Then
txtOutput.Text = "To be, or not to be."
ElseIf letter = "C" Then
txtOutput.Text = "Oh, say, can you see."
Else
txtOutput.Text = "Not a valid letter."
End If
End Sub

4. Identify the errors.
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
'Is your program correct?
Dim query, answer1, answer2 As String
query = "Are you sure everything in your program is correct?"
answer1 = InputBox(query)
answer1 = answer1.ToUpper.Substring(0, 1)
If answer1 = "N" Then
txtOutput.Text = "Don't patch bad code, rewrite it."
Else
query = "Does your program run correctly?"
answer2 = InputBox(query)
answer2 = answer2.ToUpper.Substring(0, 1)
If answer2 = "Y" Then
txtOutput.Text = "Congratulations."
Else
txtOutput.Text = "Something you are sure about is wrong."
End If
End Sub

5. The current calendar, called the Gregorian calendar, was introduced in 1582. Every year divisible by four was declared to be a leap year, with the exception of the years ending in 00 (that is those divisible by 100) and not divisible by 400. For instance, the years 1600 and 2000 are leap years, but 1700, 1800, and 1900 are not. Write a program that requests a year as input and states whether it is a leap year. (Test the program on the years 2008, 2009, 1900, and 2000.)

6. For each of the responses shown in the parentheses, determine the output displayed in the text box when the button is clicked.
Private Sub btnDisplay_Click(...) Handles btnDisplay.Click
Dim yearENIAC As Integer
'Ask question and obtain answer
Dim message As String
message = "In what year was the ENIAC computer completed?"
yearENIAC = CInt(InputBox(message))
'Respond to answer
Select Case yearENIAC
Case 1945
txtOutput.Text = "Correct."
Case 1943 To 1947
txtOutput.Text = "Close, 1945."
Case Is < 1943
txtOutput.Text = "Sorry, 1945. Work on the ENIAC " & _
"began in June 1943."
Case Is > 1947
txtOutput.Text = "No, 1945. By then IBM had built " & _
"a stored-program computer."
End Select
End Sub
(1940, 1945, 1950)

7. Rewrite the code using a Select Case block.
If a = 1 Then
lstOutput.Items.Add("lambs")
End If
If ((a <= 3) And (a < 4)) Then
lstOutput.Items.Add("eat")
End If
If ((a = 5) Or (a > 7)) Then
lstOutput.Items.Add("ivy")
End If.

Reference no: EM13811133

Questions Cloud

Describe correlations and regression analyses : Describe correlations and regression analyses
Items in meeting organizational objectives : Describe the importance of the three items in meeting organizational objectives. Include at least one source other than the textbook.
Question regarding the creative organizations : Identify two (2) organizations and contrast and compare their Creative processes. Identify internal and external drivers of innovation for these organizations.
Define play a watchdog role of keeping government honest : The media is expected to play a "watchdog" role of "keeping government honest." Is the media doing this effectively. Why do you think so
Determine the output displayed in the text box : For each of the responses shown in the parentheses, determine the output displayed in the text box when the button is clicked
Write a program that asks for the amount of the bill : Write a program that asks for the amount of the bill and percentage tip and calculates the tip. The program should use variables for each of the quantities and display the outcome in a text box with a label. Test the program on a bill of $20 and a..
What is cultural geography or human geography : What is Cultural geography or Human Geography
What is the magnitude of the workers displacement : A worker leaves home at 9:00 AM, travels 40 km to the office, and then returns home at 5:00 PM. What is the magnitude of the worker's displacement during this 8-hour span of time?
What are the initial and final tensions in the string : Is the angular momentum of the block conserved - what is the final angular speed and What are the initial and final tensions in the string.

Reviews

Write a Review

Visual Basic Programming Questions & Answers

  Explanation of benefits to the business

Explanation of benefits to the business of using your proposed system, both tangible and intangible

  Calculates the sum of the mathematical series

Write a Function procedure that implements the above code to calculate 2 to the exponent. This function should accept an Integer value and calculate 2 to that exponent, returning this calculated value in the end - Write a Function procedure that ca..

  Write a program that displays the patterns separately

Write a program that displays the patterns separately, one below the other in a TextBox - Maximize your use of repetition and maximize the number of output statements.

  Arithmetic calculator application

Arithmetic Calculator Application - Write an application that allows the user to enter a series of numbers and manipulate them.

  Keep a record of the total attendance

Keep a record of the total attendance and the total cash collected from ticket sales from all events happening at the Games.

  Write a program using visual basic 2012

write a program using Visual Basic 2012 that reads a test score from a text box each time a button is clicked, and then displays the two highest scores whenever a second button is clicked. Use two class-level variables to track the two highest scores..

  Write a program that displays in a textbox

Set the TextBox''s MultiLine property to True and its ScrollBars property to Vertical so that you can scroll through the results.

  Gas pump create an application that stimulates the

create an application that stimulates the functionality of the gas pump. user enters the number of gallons to purchase

  Create an application user to enter the following employee

Create an application that allows the user to enter the following employee data: First Name, Middle Name, Last Name, Employee Number, Department, Telephone Number, Telephone Extension, and E- mail Address. The valid selections for depart-ment are Acc..

  Using visual studio, create sample class implementations

Using Visual Studio, create sample class implementations. These will be code stubs that provide the basis for the classes you will be using

  Create visual logic files to execute each of the tasks

Create a Word document for each of the tasks. The document should contain: a brief description of the task the pseudocode associated with the task Create Visual Logic files to execute each of the tasks.

  Write a vbscript function called maxnum that accepts numbers

Write a VBScript function called MaxNum that accepts two numbers and returns the largest of the two numbers

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