SlideShare une entreprise Scribd logo
1  sur  2
Télécharger pour lire hors ligne
Visual Basic Programming [Lesson 1 To Lesson 3]
1 of 2
Conditional Logic: Exercises
Author: Kasun Ranga Wijeweera
Email: krw19870829@gmail.com
Date: 2020 May 27
1)
a) Start a new Visual Basic Windows Forms Application project.
b) Add a text box to the form and name it as txtNum.
c) Add a button to the form and name it as btnCheck.
d) Change the Text property of the button to “Check”.
e) Program the button according to the steps given below.
f) The user is expected to enter an integer in the text box.
g) The text “Even” should be displayed in a message box if the integer entered in the text
box is even. Otherwise the text “Odd” should be displayed in a message box.
2)
a) Start a new Visual Basic Windows Forms Application project.
b) Add a text box to the form and name it as txtNumber.
c) Add a button to the form and name it as btnInRange.
d) Change the Text property of the button to “Is in Range?”.
e) Program the button according to the steps given below.
f) The user is expected to enter a number in the text box.
g) The text “Yes” should be displayed in a message box if the number is greater than or
equal to 5 AND less than 12. Otherwise the text “No” should be displayed in a message
box.
3)
a) Start a new Visual Basic Windows Forms Application project.
b) Add a text box to the form and name it as txtNumber.
c) Add a button to the form and name it as btnInRange.
d) Change the Text property of the button to “Is in Range?”.
e) Program the button according to the steps given below.
f) The user is expected to enter a number in the text box.
g) The text “Yes” should be displayed in a message box if the number is less than 3 OR
greater than 17. Otherwise the text “No” should be displayed in a message box.
Visual Basic Programming [Lesson 1 To Lesson 3]
2 of 2
4)
a) Start a new Visual Basic Windows Forms Application project.
b) Add four text boxes with names txtX1, txtY1, txtX2, txtY2 and label them as “x1”, “y1”,
“x2”, “y2” respectively.
c) The four text boxes represent the coordinates of two points (x1, y1) and (x2, y2).
d) Add a button to the form and name it as btnCoincide.
e) Change the Text property of the button to “Is Coincide?”.
f) Program the button according to the steps given below.
g) The text “Yes” should be displayed in a message box if the two points coincide.
Otherwise the text “No” should be displayed in a message box.
5)
a) Start a new Visual Basic Windows Forms Application project.
b) Add four text boxes with names txtX1, txtY1, txtX2, txtY2 and label them as “x1”, “y1”,
“x2”, “y2” respectively.
c) The four text boxes represent the coordinates of two points (x1, y1) and (x2, y2).
d) Add a button to the form and name it as btnDistinct.
e) Change the Text property of the button to “Is Distinct?”.
f) Program the button according to the steps given below.
a) The text “Yes” should be displayed in a message box if the two points coincide.
Otherwise the text “No” should be displayed in a message box.
6)
a) Start a new Visual Basic Windows Forms Application project.
b) Add a text box to the form with name txtMarks and label it as “Marks”.
c) Add a button to the form and name it as btnGrade.
d) Program the button according to the steps given below.
e) The user is expected to enter a number from 0 to 100 in the text box.
f) The number in the text box is marks.
g) The grade is calculated based on the marks according to the table given below.
marks grade
80 ≤ marks < 100 A
60 ≤ marks < 80 B
40 ≤ marks < 60 C
20 ≤ marks < 40 D
0 ≤ marks < 20 E
h) The grade should be displayed in a message box.

Contenu connexe

Similaire à Conditional Logic: Exercises

COSC 1436 Project Page 1 Pre Project Example Secti.docx
COSC 1436 Project Page 1  Pre Project Example Secti.docxCOSC 1436 Project Page 1  Pre Project Example Secti.docx
COSC 1436 Project Page 1 Pre Project Example Secti.docx
faithxdunce63732
 
Spf chapter 03 WinForm
Spf chapter 03 WinFormSpf chapter 03 WinForm
Spf chapter 03 WinForm
Hock Leng PUAH
 
Assignment DetailsYou have learned that some markets are compet.docx
Assignment DetailsYou have learned that some markets are compet.docxAssignment DetailsYou have learned that some markets are compet.docx
Assignment DetailsYou have learned that some markets are compet.docx
faithxdunce63732
 

Similaire à Conditional Logic: Exercises (20)

Assignment for Variables
Assignment for VariablesAssignment for Variables
Assignment for Variables
 
Assignment for Events
Assignment for EventsAssignment for Events
Assignment for Events
 
COSC 1436 Project Page 1 Pre Project Example Secti.docx
COSC 1436 Project Page 1  Pre Project Example Secti.docxCOSC 1436 Project Page 1  Pre Project Example Secti.docx
COSC 1436 Project Page 1 Pre Project Example Secti.docx
 
Quiz 7-11
Quiz 7-11Quiz 7-11
Quiz 7-11
 
Chapter 03 - Program Coding and Design
Chapter 03 - Program Coding and DesignChapter 03 - Program Coding and Design
Chapter 03 - Program Coding and Design
 
Spf chapter 03 WinForm
Spf chapter 03 WinFormSpf chapter 03 WinForm
Spf chapter 03 WinForm
 
You have been engaged to develop a special calculator program. T.docx
You have been engaged to develop a special calculator program. T.docxYou have been engaged to develop a special calculator program. T.docx
You have been engaged to develop a special calculator program. T.docx
 
Vp lecture 11 ararat
Vp lecture 11 araratVp lecture 11 ararat
Vp lecture 11 ararat
 
Chapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface DesignChapter 2 — Program and Graphical User Interface Design
Chapter 2 — Program and Graphical User Interface Design
 
Project advance itt
Project advance ittProject advance itt
Project advance itt
 
Computer science sqp
Computer science sqpComputer science sqp
Computer science sqp
 
Winisisx
WinisisxWinisisx
Winisisx
 
Prep 2-booklet-2nd-term-2016-2017
Prep 2-booklet-2nd-term-2016-2017Prep 2-booklet-2nd-term-2016-2017
Prep 2-booklet-2nd-term-2016-2017
 
SPF WinForm Programs
SPF WinForm ProgramsSPF WinForm Programs
SPF WinForm Programs
 
JAVA practical Exam Questions (1).docx
JAVA practical Exam Questions (1).docxJAVA practical Exam Questions (1).docx
JAVA practical Exam Questions (1).docx
 
C# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slidesC# Tutorial MSM_Murach chapter-10-slides
C# Tutorial MSM_Murach chapter-10-slides
 
Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding
 
Chapter ii c#(building a user interface)
Chapter ii c#(building a user interface)Chapter ii c#(building a user interface)
Chapter ii c#(building a user interface)
 
Assignment DetailsYou have learned that some markets are compet.docx
Assignment DetailsYou have learned that some markets are compet.docxAssignment DetailsYou have learned that some markets are compet.docx
Assignment DetailsYou have learned that some markets are compet.docx
 
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
 

Plus de Kasun Ranga Wijeweera

On the Convex Layers of a Planer Dynamic Set of Points [Short Version]
On the Convex Layers of a Planer Dynamic Set of Points [Short Version]On the Convex Layers of a Planer Dynamic Set of Points [Short Version]
On the Convex Layers of a Planer Dynamic Set of Points [Short Version]
Kasun Ranga Wijeweera
 

Plus de Kasun Ranga Wijeweera (20)

Decorator Design Pattern in C#
Decorator Design Pattern in C#Decorator Design Pattern in C#
Decorator Design Pattern in C#
 
Singleton Design Pattern in C#
Singleton Design Pattern in C#Singleton Design Pattern in C#
Singleton Design Pattern in C#
 
Introduction to Design Patterns
Introduction to Design PatternsIntroduction to Design Patterns
Introduction to Design Patterns
 
Algorithms for Convex Partitioning of a Polygon
Algorithms for Convex Partitioning of a PolygonAlgorithms for Convex Partitioning of a Polygon
Algorithms for Convex Partitioning of a Polygon
 
Geometric Transformations II
Geometric Transformations IIGeometric Transformations II
Geometric Transformations II
 
Geometric Transformations I
Geometric Transformations IGeometric Transformations I
Geometric Transformations I
 
Introduction to Polygons
Introduction to PolygonsIntroduction to Polygons
Introduction to Polygons
 
Bresenham Line Drawing Algorithm
Bresenham Line Drawing AlgorithmBresenham Line Drawing Algorithm
Bresenham Line Drawing Algorithm
 
Digital Differential Analyzer Line Drawing Algorithm
Digital Differential Analyzer Line Drawing AlgorithmDigital Differential Analyzer Line Drawing Algorithm
Digital Differential Analyzer Line Drawing Algorithm
 
Getting Started with Visual Basic Programming
Getting Started with Visual Basic ProgrammingGetting Started with Visual Basic Programming
Getting Started with Visual Basic Programming
 
CheckBoxes and RadioButtons
CheckBoxes and RadioButtonsCheckBoxes and RadioButtons
CheckBoxes and RadioButtons
 
Variables in Visual Basic Programming
Variables in Visual Basic ProgrammingVariables in Visual Basic Programming
Variables in Visual Basic Programming
 
Loops in Visual Basic Programming
Loops in Visual Basic ProgrammingLoops in Visual Basic Programming
Loops in Visual Basic Programming
 
Conditional Logic in Visual Basic Programming
Conditional Logic in Visual Basic ProgrammingConditional Logic in Visual Basic Programming
Conditional Logic in Visual Basic Programming
 
Assignment for Factory Method Design Pattern in C# [ANSWERS]
Assignment for Factory Method Design Pattern in C# [ANSWERS]Assignment for Factory Method Design Pattern in C# [ANSWERS]
Assignment for Factory Method Design Pattern in C# [ANSWERS]
 
Arrays in Visual Basic Programming
Arrays in Visual Basic ProgrammingArrays in Visual Basic Programming
Arrays in Visual Basic Programming
 
An Exercise for Factory Method Design Pattern in C#
An Exercise for Factory Method Design Pattern in C#An Exercise for Factory Method Design Pattern in C#
An Exercise for Factory Method Design Pattern in C#
 
Algorithmic Software Cost Modeling
Algorithmic Software Cost ModelingAlgorithmic Software Cost Modeling
Algorithmic Software Cost Modeling
 
Object Oriented Programming Assignment 4
Object Oriented Programming Assignment 4Object Oriented Programming Assignment 4
Object Oriented Programming Assignment 4
 
On the Convex Layers of a Planer Dynamic Set of Points [Short Version]
On the Convex Layers of a Planer Dynamic Set of Points [Short Version]On the Convex Layers of a Planer Dynamic Set of Points [Short Version]
On the Convex Layers of a Planer Dynamic Set of Points [Short Version]
 

Dernier

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Dernier (20)

The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 

Conditional Logic: Exercises

  • 1. Visual Basic Programming [Lesson 1 To Lesson 3] 1 of 2 Conditional Logic: Exercises Author: Kasun Ranga Wijeweera Email: krw19870829@gmail.com Date: 2020 May 27 1) a) Start a new Visual Basic Windows Forms Application project. b) Add a text box to the form and name it as txtNum. c) Add a button to the form and name it as btnCheck. d) Change the Text property of the button to “Check”. e) Program the button according to the steps given below. f) The user is expected to enter an integer in the text box. g) The text “Even” should be displayed in a message box if the integer entered in the text box is even. Otherwise the text “Odd” should be displayed in a message box. 2) a) Start a new Visual Basic Windows Forms Application project. b) Add a text box to the form and name it as txtNumber. c) Add a button to the form and name it as btnInRange. d) Change the Text property of the button to “Is in Range?”. e) Program the button according to the steps given below. f) The user is expected to enter a number in the text box. g) The text “Yes” should be displayed in a message box if the number is greater than or equal to 5 AND less than 12. Otherwise the text “No” should be displayed in a message box. 3) a) Start a new Visual Basic Windows Forms Application project. b) Add a text box to the form and name it as txtNumber. c) Add a button to the form and name it as btnInRange. d) Change the Text property of the button to “Is in Range?”. e) Program the button according to the steps given below. f) The user is expected to enter a number in the text box. g) The text “Yes” should be displayed in a message box if the number is less than 3 OR greater than 17. Otherwise the text “No” should be displayed in a message box.
  • 2. Visual Basic Programming [Lesson 1 To Lesson 3] 2 of 2 4) a) Start a new Visual Basic Windows Forms Application project. b) Add four text boxes with names txtX1, txtY1, txtX2, txtY2 and label them as “x1”, “y1”, “x2”, “y2” respectively. c) The four text boxes represent the coordinates of two points (x1, y1) and (x2, y2). d) Add a button to the form and name it as btnCoincide. e) Change the Text property of the button to “Is Coincide?”. f) Program the button according to the steps given below. g) The text “Yes” should be displayed in a message box if the two points coincide. Otherwise the text “No” should be displayed in a message box. 5) a) Start a new Visual Basic Windows Forms Application project. b) Add four text boxes with names txtX1, txtY1, txtX2, txtY2 and label them as “x1”, “y1”, “x2”, “y2” respectively. c) The four text boxes represent the coordinates of two points (x1, y1) and (x2, y2). d) Add a button to the form and name it as btnDistinct. e) Change the Text property of the button to “Is Distinct?”. f) Program the button according to the steps given below. a) The text “Yes” should be displayed in a message box if the two points coincide. Otherwise the text “No” should be displayed in a message box. 6) a) Start a new Visual Basic Windows Forms Application project. b) Add a text box to the form with name txtMarks and label it as “Marks”. c) Add a button to the form and name it as btnGrade. d) Program the button according to the steps given below. e) The user is expected to enter a number from 0 to 100 in the text box. f) The number in the text box is marks. g) The grade is calculated based on the marks according to the table given below. marks grade 80 ≤ marks < 100 A 60 ≤ marks < 80 B 40 ≤ marks < 60 C 20 ≤ marks < 40 D 0 ≤ marks < 20 E h) The grade should be displayed in a message box.