SlideShare a Scribd company logo
Start FreshDownload from	TPITVB.blogspot.com21
Start freshStart VS 2005 and Create a new project: Calculator_IT1C_xxChoose appropriate directory and remember its pathExit VS 2005Unzip start_cal.zip: Form1.vb and Form1.Designer.vbUse File explorer to replace the two newly created project files in Calculator_IT1C_xx
ButtonSqrt_ClickDouble click on the button for Sqrt to generate the ButtonSqrt_Click subroutineCopy the codes from ButtonEqual_ClickModify the following line to use Math.Sqrt		total = total + x		total = Math.Sqrt(x)
ButtonPercent_ClickDouble click on the button for % to generate the ButtonPercent_Click subroutineCopy the codes from ButtonEqual_ClickModify the following line to use Math.Sqrt		total = total + x		total = x / 100
DotPrivate Sub ButtonDot_Click‘ Copy the codes from Button0‘ Replace “0”  with “.” 	Dim existingString As String = TextBox1.Text 	If existingString <> "" Then   	 	TextBox1.Text = existingString & "0" 	End IfEnd Sub“.”
Testing1.5  OK0.5  NG  => How?
DotPrivate Sub ButtonDot_Click‘ Add else condition‘ to add “0.”   Dim existingString As String = TextBox1.Text   If existingString <> "" Then      TextBox1.Text = existingString & “.”   End IfEnd Sub  ElseTextBox1.Text = existingString & “0.” End IfEnd Sub
Testing1.5  OK0.5  OK1.5.5.  => should not allow – How?
How to stop “1.5.5.”?We need to use a global variable to track if “.” has been set Then add additional codes in ButtonDot to check this variable
DotGlobal variable:Public Class Form1Dim isDotted As Boolean = False
DotPrivate Sub ButtonDot_Click‘ Add Condition to check for isDottedDim existingString As String = TextBox1.TextIf existingString <> "" ThenTextBox1.Text = existingString & “.”   ElseTextBox1.Text = existingString & “0.”    End IfEnd SubIf  isDotted = False  ThenisDotted= True      ‘ Set isDotted to True   End IfEnd Sub
Testing1.5  OK0.5  OK1.5.5. OK1.5  Clear  1.5  => NG - How?
DotPrivate Sub ButtonClear_Click		:		:	‘ Reset isDotted to FalseisDotted = FalseEnd Sub
Testing1.5  OK0.5  OK1.5.5. OK1.5  Clear  1.5  OK1.5 + 1.5 => NG – How?
DotPrivate Sub ButtonPlus_Click			:			:	‘ Reset isDotted to FalseisDotted = FalseEnd Sub
Testing1.5  OK0.5  OK1.5.5. OK1.5  Clear  1.5  OK1.5 + 1.5 OKAnymore cases?
Minus, Multiply and DivideBefore we proceed to add the processing for Minus, Multiply and Divide,we need to modify the current processing for Plus and Equal
Modify Plus and EqualPrivate Sub ButtonPlus_Click			:			:	total  =   total  +  x			:End  Subtotal  =  x		‘  Now, Plus can only be 				‘  pressed once.
Modify Plus and EqualGlobal variable:Public Class Form1	Dim  whatFunction  As  String  =  “None”
Modify Plus and EqualPrivate Sub ButtonPlus_Click			:			:whatFunction = “Plus”End  Sub
Modify Plus and EqualPrivate Sub ButtonEqual_Click			:			:	total = total + x			:End  SubSelect  Case  whatFunctionCase  “Plus”   		total  =  total + xEnd SelectCase  “Minus”
Add Minus, Multiply and DivideComplete the processing for minus, multiply and divide.Take care of divide by zero error with if then else statementDo testingand debugging to take care of other errors

More Related Content

PPTX
DOCX
Oracle Fusion Web Clock Setup(Oracle Time and Labor)
PDF
Calculator 1
PDF
U wont bleev wut dis code doez
PDF
Calculator 2
PDF
Calculator 3
PDF
How to use google sheets
PPT
Rational rose
Oracle Fusion Web Clock Setup(Oracle Time and Labor)
Calculator 1
U wont bleev wut dis code doez
Calculator 2
Calculator 3
How to use google sheets
Rational rose

What's hot (6)

DOCX
Providing sl no in Gridview in Dot Net
PDF
Web services in asp.net
DOCX
Keyboard shortcut - Phím tắt hệ điều hành windows 10
DOCX
How to add sql server table into dot net web page (Gridview)
DOCX
How to add sorting and pagers to grid view
DOCX
Bd1 erdenejargal b 2
Providing sl no in Gridview in Dot Net
Web services in asp.net
Keyboard shortcut - Phím tắt hệ điều hành windows 10
How to add sql server table into dot net web page (Gridview)
How to add sorting and pagers to grid view
Bd1 erdenejargal b 2
Ad

Similar to Calculator Processing (20)

PDF
Calculator 4
PDF
Delphi L08 Controls at Runtime P2
PDF
Cognos TM1 Assignments
PPTX
C# Loops
DOC
Devry cis 170 c i lab 1 of 7 getting started
DOC
Devry cis 170 c i lab 1 of 7 getting started
DOC
Ankit Phadia Hacking tools (1)
DOCX
Steps how to do cmd
PDF
Numerical modeling of concrete in Abaqus
PDF
Calculator 5
PDF
TDD, BDD and mocks
PDF
Tutorials.pdf
PDF
Test driven development
PPTX
Web Server Controls CS Set
PPTX
Strings in python are surrounded by eith
PPTX
Cpp Homework Help
PPTX
Cookbook Oracle SOA Business Rules
PPT
Java căn bản - Chapter6
DOC
Ankit Phadia Hacking tools
PPTX
Daa unit 1
Calculator 4
Delphi L08 Controls at Runtime P2
Cognos TM1 Assignments
C# Loops
Devry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting started
Ankit Phadia Hacking tools (1)
Steps how to do cmd
Numerical modeling of concrete in Abaqus
Calculator 5
TDD, BDD and mocks
Tutorials.pdf
Test driven development
Web Server Controls CS Set
Strings in python are surrounded by eith
Cpp Homework Help
Cookbook Oracle SOA Business Rules
Java căn bản - Chapter6
Ankit Phadia Hacking tools
Daa unit 1
Ad

More from Hock Leng PUAH (20)

PDF
ASP.net Image Slideshow
PDF
Visual basic asp.net programming introduction
PDF
Using iMac Built-in Screen Sharing
PDF
Hosting SWF Flash file
PDF
PHP built-in functions date( ) and mktime( ) to calculate age from date of birth
PDF
PHP built-in function mktime example
PDF
A simple php exercise on date( ) function
PDF
Integrate jQuery PHP MySQL project to JOOMLA web site
PPTX
Responsive design
PDF
Step by step guide to use mac lion to make hidden folders visible
PPTX
Beautiful web pages
PPT
CSS Basic and Common Errors
PPTX
Connectivity Test for EES Logic Probe Project
PPTX
Logic gate lab intro
PDF
Ohm's law, resistors in series or in parallel
PPTX
Connections Exercises Guide
PPTX
Design to circuit connection
PPTX
NMS Media Services Jobshet 1 to 5 Summary
DOCX
Virtualbox step by step guide
PPTX
Nms chapter 01
ASP.net Image Slideshow
Visual basic asp.net programming introduction
Using iMac Built-in Screen Sharing
Hosting SWF Flash file
PHP built-in functions date( ) and mktime( ) to calculate age from date of birth
PHP built-in function mktime example
A simple php exercise on date( ) function
Integrate jQuery PHP MySQL project to JOOMLA web site
Responsive design
Step by step guide to use mac lion to make hidden folders visible
Beautiful web pages
CSS Basic and Common Errors
Connectivity Test for EES Logic Probe Project
Logic gate lab intro
Ohm's law, resistors in series or in parallel
Connections Exercises Guide
Design to circuit connection
NMS Media Services Jobshet 1 to 5 Summary
Virtualbox step by step guide
Nms chapter 01

Recently uploaded (20)

PPTX
Cell Structure & Organelles in detailed.
PDF
Complications of Minimal Access Surgery at WLH
PDF
Classroom Observation Tools for Teachers
PPTX
Institutional Correction lecture only . . .
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Basic Mud Logging Guide for educational purpose
PDF
Pre independence Education in Inndia.pdf
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
Pharma ospi slides which help in ospi learning
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
Cell Structure & Organelles in detailed.
Complications of Minimal Access Surgery at WLH
Classroom Observation Tools for Teachers
Institutional Correction lecture only . . .
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Basic Mud Logging Guide for educational purpose
Pre independence Education in Inndia.pdf
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Final Presentation General Medicine 03-08-2024.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Pharma ospi slides which help in ospi learning
2.FourierTransform-ShortQuestionswithAnswers.pdf
Cell Types and Its function , kingdom of life
PPH.pptx obstetrics and gynecology in nursing
102 student loan defaulters named and shamed – Is someone you know on the list?
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
STATICS OF THE RIGID BODIES Hibbelers.pdf

Calculator Processing

  • 2. Start freshStart VS 2005 and Create a new project: Calculator_IT1C_xxChoose appropriate directory and remember its pathExit VS 2005Unzip start_cal.zip: Form1.vb and Form1.Designer.vbUse File explorer to replace the two newly created project files in Calculator_IT1C_xx
  • 3. ButtonSqrt_ClickDouble click on the button for Sqrt to generate the ButtonSqrt_Click subroutineCopy the codes from ButtonEqual_ClickModify the following line to use Math.Sqrt total = total + x total = Math.Sqrt(x)
  • 4. ButtonPercent_ClickDouble click on the button for % to generate the ButtonPercent_Click subroutineCopy the codes from ButtonEqual_ClickModify the following line to use Math.Sqrt total = total + x total = x / 100
  • 5. DotPrivate Sub ButtonDot_Click‘ Copy the codes from Button0‘ Replace “0” with “.” Dim existingString As String = TextBox1.Text If existingString <> "" Then TextBox1.Text = existingString & "0" End IfEnd Sub“.”
  • 6. Testing1.5 OK0.5 NG => How?
  • 7. DotPrivate Sub ButtonDot_Click‘ Add else condition‘ to add “0.” Dim existingString As String = TextBox1.Text If existingString <> "" Then TextBox1.Text = existingString & “.” End IfEnd Sub ElseTextBox1.Text = existingString & “0.” End IfEnd Sub
  • 8. Testing1.5 OK0.5 OK1.5.5. => should not allow – How?
  • 9. How to stop “1.5.5.”?We need to use a global variable to track if “.” has been set Then add additional codes in ButtonDot to check this variable
  • 10. DotGlobal variable:Public Class Form1Dim isDotted As Boolean = False
  • 11. DotPrivate Sub ButtonDot_Click‘ Add Condition to check for isDottedDim existingString As String = TextBox1.TextIf existingString <> "" ThenTextBox1.Text = existingString & “.” ElseTextBox1.Text = existingString & “0.” End IfEnd SubIf isDotted = False ThenisDotted= True ‘ Set isDotted to True End IfEnd Sub
  • 12. Testing1.5 OK0.5 OK1.5.5. OK1.5 Clear 1.5 => NG - How?
  • 13. DotPrivate Sub ButtonClear_Click : : ‘ Reset isDotted to FalseisDotted = FalseEnd Sub
  • 14. Testing1.5 OK0.5 OK1.5.5. OK1.5 Clear 1.5 OK1.5 + 1.5 => NG – How?
  • 15. DotPrivate Sub ButtonPlus_Click : : ‘ Reset isDotted to FalseisDotted = FalseEnd Sub
  • 16. Testing1.5 OK0.5 OK1.5.5. OK1.5 Clear 1.5 OK1.5 + 1.5 OKAnymore cases?
  • 17. Minus, Multiply and DivideBefore we proceed to add the processing for Minus, Multiply and Divide,we need to modify the current processing for Plus and Equal
  • 18. Modify Plus and EqualPrivate Sub ButtonPlus_Click : : total = total + x :End Subtotal = x ‘ Now, Plus can only be ‘ pressed once.
  • 19. Modify Plus and EqualGlobal variable:Public Class Form1 Dim whatFunction As String = “None”
  • 20. Modify Plus and EqualPrivate Sub ButtonPlus_Click : :whatFunction = “Plus”End Sub
  • 21. Modify Plus and EqualPrivate Sub ButtonEqual_Click : : total = total + x :End SubSelect Case whatFunctionCase “Plus” total = total + xEnd SelectCase “Minus”
  • 22. Add Minus, Multiply and DivideComplete the processing for minus, multiply and divide.Take care of divide by zero error with if then else statementDo testingand debugging to take care of other errors