Introduction to Visual Basic: Decision-Making Constructs
VerifiedAdded on 2025/06/18
|10
|675
|482
AI Summary
Desklib provides solved assignments and past papers to help students succeed.

Foundations in Programming
Code: QAC020B021S
Assignment 1
Student Name:
Student ID:
Code: QAC020B021S
Assignment 1
Student Name:
Student ID:
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Table of Contents
Question 1......................................................................................................................................2
Flow Chart..................................................................................................................................2
Output Screen............................................................................................................................3
Question 2......................................................................................................................................4
Comparison between if-else and select case statements..................................................4
Advantages and Disadvantages.............................................................................................5
References.....................................................................................................................................8
Appendix.........................................................................................................................................9
List of Figures
Figure 1: Flow Chart.........................................................................................................2
Figure 2: Monthly Wage Calculator..................................................................................3
Figure 3: Example of Select case.................................................................................... 5
Figure 4: Example of Select case.................................................................................... 6
Figure 5: Example of if-else............................................................................................. 7
1
Question 1......................................................................................................................................2
Flow Chart..................................................................................................................................2
Output Screen............................................................................................................................3
Question 2......................................................................................................................................4
Comparison between if-else and select case statements..................................................4
Advantages and Disadvantages.............................................................................................5
References.....................................................................................................................................8
Appendix.........................................................................................................................................9
List of Figures
Figure 1: Flow Chart.........................................................................................................2
Figure 2: Monthly Wage Calculator..................................................................................3
Figure 3: Example of Select case.................................................................................... 5
Figure 4: Example of Select case.................................................................................... 6
Figure 5: Example of if-else............................................................................................. 7
1

Question 1
Flow Chart
Figure 1: Flow Chart
In the above figure, it shows the flow chart of the design application for calculation of net
wages and the total savings. For calculating the net wages, the formula is implemented
on the gross value provided by the user and after that, the savings will be calculated
from the amount of the net wages.
2
Flow Chart
Figure 1: Flow Chart
In the above figure, it shows the flow chart of the design application for calculation of net
wages and the total savings. For calculating the net wages, the formula is implemented
on the gross value provided by the user and after that, the savings will be calculated
from the amount of the net wages.
2
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Output Screen
Figure 2: Monthly Wage Calculator
3
Figure 2: Monthly Wage Calculator
3
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Question 2
Visual Basic is a programming environment by Microsoft, in this a programmer deal with
the Graphical user interface called GUI. The GUI modifies the already selected sections
of codes that are written in a programming language, now as per this question, it has to
be discussing the decision-making constructs of VB they are the if-else and selected
case (Rouse, 2011).
The decision making in VB will be in the form of True and False, there are two operators
named as comparison operator which show all result in true and false and the other
operator is mathematical which gives numeric value as a result (Sagar, 2012).
If-else: If-else statement is used when both true and false results are present in the
condition or we have to show both the condition, then If show true and else show false.
Select case: When there is a lot of conditional statement then the select case will be
the most suitable case to show a result.
Comparison between if-else and select case statements
Table 1: Comparison of if-else and select case
If-else Select case
When both true and false condition has to
be shown in the result.
When multiple conditions have to be
shown in the result.
It works on the comparison operator, in
visual basic.
It will not work in comparison operator, in
visual basic.
The use else is to show the Boolean
expression is false.
Here no use of else is required.
If-else also deals with multiple conditions
but in this, the expression will become too
complex.
In select, case the expression will not be
complex.
Syntax:
If(boolean_expression)Then
'statement(s) will execute if the Boolean
expression is true
Else
'statement(s) will execute if the Boolean
expression is false
End If
Syntax:
Select [ Case ] testexpression
[ Case expressionlist
[ statements ] ]
[ Case Else
[ elsestatements ] ]
End Select
4
Visual Basic is a programming environment by Microsoft, in this a programmer deal with
the Graphical user interface called GUI. The GUI modifies the already selected sections
of codes that are written in a programming language, now as per this question, it has to
be discussing the decision-making constructs of VB they are the if-else and selected
case (Rouse, 2011).
The decision making in VB will be in the form of True and False, there are two operators
named as comparison operator which show all result in true and false and the other
operator is mathematical which gives numeric value as a result (Sagar, 2012).
If-else: If-else statement is used when both true and false results are present in the
condition or we have to show both the condition, then If show true and else show false.
Select case: When there is a lot of conditional statement then the select case will be
the most suitable case to show a result.
Comparison between if-else and select case statements
Table 1: Comparison of if-else and select case
If-else Select case
When both true and false condition has to
be shown in the result.
When multiple conditions have to be
shown in the result.
It works on the comparison operator, in
visual basic.
It will not work in comparison operator, in
visual basic.
The use else is to show the Boolean
expression is false.
Here no use of else is required.
If-else also deals with multiple conditions
but in this, the expression will become too
complex.
In select, case the expression will not be
complex.
Syntax:
If(boolean_expression)Then
'statement(s) will execute if the Boolean
expression is true
Else
'statement(s) will execute if the Boolean
expression is false
End If
Syntax:
Select [ Case ] testexpression
[ Case expressionlist
[ statements ] ]
[ Case Else
[ elsestatements ] ]
End Select
4

Advantages and Disadvantages
Advantages of the select case-
It has good visually when you have several conditions to test against any
condition.
It is much more readable as comparative to if-else.
It can easily deal with the complex problem.
It uses expressions as a point not as constant (Warner, 2011).
Disadvantages of the select case-
Sometimes it becomes harder to optimize the code.
It has to be very careful when a condition has to be selected.
Figure 3: Example of Select case
(Source: VBtutor.net, 2017)
5
Advantages of the select case-
It has good visually when you have several conditions to test against any
condition.
It is much more readable as comparative to if-else.
It can easily deal with the complex problem.
It uses expressions as a point not as constant (Warner, 2011).
Disadvantages of the select case-
Sometimes it becomes harder to optimize the code.
It has to be very careful when a condition has to be selected.
Figure 3: Example of Select case
(Source: VBtutor.net, 2017)
5
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Figure 4: Example of Select case
(Source: VBtutor.net, 2017)
Advantage of if-else-
If-else is good when the condition of comparison arrived between two conditions.
It is very flexible for a small problem.
It is easy to execute.
Disadvantages of if-else-
It can deal with multiple conditions but in this statement, it will become complex.
I cannot deal with a complex problem.
It became messy when it has to deal with more than two conditions.
6
(Source: VBtutor.net, 2017)
Advantage of if-else-
If-else is good when the condition of comparison arrived between two conditions.
It is very flexible for a small problem.
It is easy to execute.
Disadvantages of if-else-
It can deal with multiple conditions but in this statement, it will become complex.
I cannot deal with a complex problem.
It became messy when it has to deal with more than two conditions.
6
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Figure 5: Example of if-else
(Source: VBtutor.net, 2019).
7
(Source: VBtutor.net, 2019).
7

References
Rouse, M., 2011. Visual Basic. Defination of Visual Basic. pp.1
Sagar, P., 2012. Select Case. Visual Basic-Decision making statement. pp.8-11.
Warner, W., 2011. Advantages and disadvantages of if-else and select case. Why to
use select case rather than if-else. pp.1-7.
8
Rouse, M., 2011. Visual Basic. Defination of Visual Basic. pp.1
Sagar, P., 2012. Select Case. Visual Basic-Decision making statement. pp.8-11.
Warner, W., 2011. Advantages and disadvantages of if-else and select case. Why to
use select case rather than if-else. pp.1-7.
8
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

Appendix
9
9
1 out of 10
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.