Rewrite the code using a select case block

Assignment Help Programming Languages
Reference no: EM13752052

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

Questions Cloud

Update your website to include a simple web form : Update your website to include a simple web form as discussed in your design document. Use JavaScript to validate the form contents and display the results of that validation to the user in a popup window
Organizational structure and strategic leadership : Discuss the following questions in relation to organizational structure and strategic leadership
What is the amount of their total tax liability : Jake and Christina are married and file a joint return for 2014 with taxable income of $100,000 and tax preferences and adjustments of $20,000 for AMT purposes. Their regular tax liability is $16,713. What is the amount of their total tax liability?
General journal entry for employers payroll tax liability : Prepare the general journal entry for the employer's payroll liability. Prepare the general journal entry for the employer's payroll tax liability. Prepare the general journal entry to liquidate the liabilities accrued in parts (a) and (b) on March 3..
Rewrite the code using a select case block : Rewrite the code using a Select Case block and Determine the output displayed in the text box when the button is clicked
Basis for determining bad debt expense : Credit Sales, $3,500,000 Sales Returns & Allowances $35,000 Accounts Receivable $200,000 and Allowance for Doubtful Accounts with a debit of $3,500. Prepare the general journal entry to record the end of the year adjusting entry if ABC uses 0.5% of N..
Describe the steps in an implementation plan : Describe the steps in an implementation plan. Identify possible project issues
Correcting entries and end-of-the period adjusting entries : Explain what type of accounts need: correcting entries, end-of-the period adjusting entries, adjusted trial balance, classified balance sheet, and the closing entries. ie. cash, accumulated depreciation, retained earnings, salaries, etc.
Betty and charles were partners. : Albert, Betty and Charles were partners. The following circumstances applied:(a) CapitalAccording to the partnership agreement, Albert and Betty each contributed $20,000. Charles contributed no capital.(b) Advances

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