Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

CD206 BUSINESS PROGRAMMING (Tutorial 4_L5a)

1- Define Nested IF statement. Support your answer with example.


Sometimes, more than one decision has to be made to determine what processing must occur.
- For instance, if one condition is true, a second condition may need to be tested before the
correct code is executed
- When an If ...Then statement is placed within another If ...Then statement, the inner If
...Then statement is said to be nested within the outer If ...Then statement
- When nesting If...Then constructs, we must have a corresponding End If statement for
every If...Then statement.
- The construct looks like this
If (expression) Then
(statements)
Else
If (expression) Then
If (expression) Then
(statements)
Else
(statements)
End If
Else
(statements)
End If
End If

2- Print the maximum and minimum number among THREE (3) integer numbers.
If num1> num2 AND num1>num3 then MessageBox.show( “num1 is the maximum number”)
elseIf num2> num3 AND num2>num1 then MessageBox.show( “num2 is the maximum
number”)

else num3> num2 AND num3>num2 then MessageBox.show( “num3 is the maximum
number”)

End if

3- Write a statement that:


(i) Set the focus on the txtLastName TextBox object.
- txtLastName.TextBox.Focus()

(ii) Removes the contents of the txtAge TextBox object.


- txtAge.TextBox.Clear()

(iii) Blanks the Text property of the lblEligibilitAge Label object.

This study source was downloaded by 100000840739874 from CourseHero.com on 02-12-2022 05:09:28 GMT -06:00

https://www.coursehero.com/file/64438973/Tutorial-4-L5adocx/
CD206 BUSINESS PROGRAMMING (Tutorial 4_L5a)

- lblEligibilitAge.text = “ ”

(iv) Convert the value in the String variable strWaistSize to an integer value and place the
integer value in a variable named intWaistSize.
- intWaistSize = integer.Parse( strWaistSize.Text)

(v) Declare a constant named decInsuranceDeductible as a Decimal value and data type and set
its value to 379.25
- Const decInsuranceDeductible As Decimal = 397.25

4- Determine if each of the following variable names is valid or invalid. Please state the error in
the invalid variable names.

Variable name Answer:


(i) _intRadian Valid
(ii) PercentfSales# Invalid. The first character must start with lowercase letter and
cannot have special character.
(iii) R743-L56 Invalid. The first character must start with lowercase letter and
connot has special character.
(iv) 3CPO Invalid. The first character cannot start with integer.
(v) Close Invalid. The first character must start with lowercase letter.
(vi) Name of client Invalid. Cannot have space.

5- Write VB .net code to run the following outputs

This study source was downloaded by 100000840739874 from CourseHero.com on 02-12-2022 05:09:28 GMT -06:00

https://www.coursehero.com/file/64438973/Tutorial-4-L5adocx/
CD206 BUSINESS PROGRAMMING (Tutorial 4_L5a)

END OF QUESTION

This study source was downloaded by 100000840739874 from CourseHero.com on 02-12-2022 05:09:28 GMT -06:00

https://www.coursehero.com/file/64438973/Tutorial-4-L5adocx/
Powered by TCPDF (www.tcpdf.org)

You might also like