SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Start Fresh Download from 	TPITVB.blogspot.com 2 1
Start fresh Start VS 2005 and Create a new project: Calculator_IT1C_xx Choose appropriate directory and remember its path Exit VS 2005 Unzip start_cal.zip: Form1.vb and Form1.Designer.vb Use File explorer to replace the two newly created project files in Calculator_IT1C_xx
ButtonSqrt_Click Double click on the button for Sqrt to generate the ButtonSqrt_Click subroutine Copy the codes from ButtonEqual_Click Modify the following line to use Math.Sqrt 		total = total + x 		total = Math.Sqrt(x)
ButtonPercent_Click Double click on the button for % to generate the ButtonPercent_Click subroutine Copy the codes from ButtonEqual_Click Modify the following line to use Math.Sqrt 		total = total + x 		total = x / 100
Dot Private 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 If End Sub “.”
Testing 1.5  OK 0.5  NG  => How?
Dot Private Sub ButtonDot_Click ‘ Add else condition ‘ to add “0.”    Dim existingString As String = TextBox1.Text    If existingString <> "" Then       TextBox1.Text = existingString & “.”    End If End Sub   Else TextBox1.Text = existingString & “0.”  End If End Sub
Testing 1.5  OK 0.5  OK 1.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
Dot Global variable: Public Class Form1 Dim isDotted As Boolean = False
Dot Private Sub ButtonDot_Click ‘ Add Condition to check for isDotted Dim existingString As String = TextBox1.Text If existingString <> "" Then TextBox1.Text = existingString & “.”    Else TextBox1.Text = existingString & “0.”     End If End Sub If  isDotted = False  Then isDotted= True      ‘ Set isDotted to True    End If End Sub
Testing 1.5  OK 0.5  OK 1.5.5. OK 1.5  Clear  1.5  => NG - How?
Dot Private Sub ButtonClear_Click 		: 		: 	‘ Reset isDotted to False isDotted = False End Sub
Testing 1.5  OK 0.5  OK 1.5.5. OK 1.5  Clear  1.5  OK 1.5 + 1.5 => NG – How?
Dot Private Sub ButtonPlus_Click 			: 			: 	‘ Reset isDotted to False isDotted = False End Sub
Testing 1.5  OK 0.5  OK 1.5.5. OK 1.5  Clear  1.5  OK 1.5 + 1.5 OK Anymore cases?
Minus, Multiply and Divide Before 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 Equal Private Sub ButtonPlus_Click 			: 			: 	total  =   total  +  x 			: End  Sub total  =  x		‘  Now, Plus can only be 				‘  pressed once.
Modify Plus and Equal Global variable: Public Class Form1 	Dim  whatFunction  As  String  =  “None”
Modify Plus and Equal Private Sub ButtonPlus_Click 			: 			: whatFunction = “Plus” End  Sub
Modify Plus and Equal Private Sub ButtonEqual_Click 			: 			: 	total = total + x 			: End  Sub Select  Case  whatFunction Case  “Plus”    		total  =  total + x End Select Case  “Minus”
Add Minus, Multiply and Divide Complete the processing for minus, multiply and divide. Take care of divide by zero error with if then else statement Do testingand debugging to take care of other errors

Weitere ähnliche Inhalte

Was ist angesagt? (6)

Providing sl no in Gridview in Dot Net
Providing sl no in Gridview in Dot NetProviding sl no in Gridview in Dot Net
Providing sl no in Gridview in Dot Net
 
Web services in asp.net
Web services in asp.netWeb services in asp.net
Web services in asp.net
 
Keyboard shortcut - Phím tắt hệ điều hành windows 10
Keyboard shortcut - Phím tắt hệ điều hành windows 10Keyboard shortcut - Phím tắt hệ điều hành windows 10
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 sql server table into dot net web page (Gridview)How to add sql server table into dot net web page (Gridview)
How to add sql server table into dot net web page (Gridview)
 
How to add sorting and pagers to grid view
How to add sorting and pagers to grid viewHow to add sorting and pagers to grid view
How to add sorting and pagers to grid view
 
Bd1 erdenejargal b 2
Bd1 erdenejargal b 2Bd1 erdenejargal b 2
Bd1 erdenejargal b 2
 

Ähnlich wie Calculator Processing

Calculator 4
Calculator 4Calculator 4
Calculator 4
livecode
 
Delphi L08 Controls at Runtime P2
Delphi L08 Controls at Runtime P2Delphi L08 Controls at Runtime P2
Delphi L08 Controls at Runtime P2
Mohammad Shaker
 
Ankit Phadia Hacking tools (1)
Ankit Phadia Hacking tools (1)Ankit Phadia Hacking tools (1)
Ankit Phadia Hacking tools (1)
Chandra Pr. Singh
 
Calculator 5
Calculator 5Calculator 5
Calculator 5
livecode
 
Java căn bản - Chapter6
Java căn bản - Chapter6Java căn bản - Chapter6
Java căn bản - Chapter6
Vince Vo
 
Gui builder
Gui builderGui builder
Gui builder
learnt
 

Ähnlich wie Calculator Processing (20)

Calculator 4
Calculator 4Calculator 4
Calculator 4
 
Delphi L08 Controls at Runtime P2
Delphi L08 Controls at Runtime P2Delphi L08 Controls at Runtime P2
Delphi L08 Controls at Runtime P2
 
Cognos TM1 Assignments
Cognos TM1 Assignments Cognos TM1 Assignments
Cognos TM1 Assignments
 
C# Loops
C# LoopsC# Loops
C# Loops
 
Devry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting startedDevry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting started
 
Devry cis 170 c i lab 1 of 7 getting started
Devry cis 170 c i lab 1 of 7 getting startedDevry 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)
Ankit Phadia Hacking tools (1)Ankit Phadia Hacking tools (1)
Ankit Phadia Hacking tools (1)
 
Steps how to do cmd
Steps how to do cmdSteps how to do cmd
Steps how to do cmd
 
Numerical modeling of concrete in Abaqus
Numerical modeling of concrete in Abaqus Numerical modeling of concrete in Abaqus
Numerical modeling of concrete in Abaqus
 
Calculator 5
Calculator 5Calculator 5
Calculator 5
 
TDD, BDD and mocks
TDD, BDD and mocksTDD, BDD and mocks
TDD, BDD and mocks
 
Tutorials.pdf
Tutorials.pdfTutorials.pdf
Tutorials.pdf
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Web Server Controls CS Set
Web Server Controls CS Set Web Server Controls CS Set
Web Server Controls CS Set
 
Cpp Homework Help
Cpp Homework Help Cpp Homework Help
Cpp Homework Help
 
Cookbook Oracle SOA Business Rules
Cookbook Oracle SOA Business RulesCookbook Oracle SOA Business Rules
Cookbook Oracle SOA Business Rules
 
Java căn bản - Chapter6
Java căn bản - Chapter6Java căn bản - Chapter6
Java căn bản - Chapter6
 
Ankit Phadia Hacking tools
Ankit Phadia Hacking toolsAnkit Phadia Hacking tools
Ankit Phadia Hacking tools
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
Gui builder
Gui builderGui builder
Gui builder
 

Mehr von Hock Leng PUAH

CSS Basic and Common Errors
CSS Basic and Common ErrorsCSS Basic and Common Errors
CSS Basic and Common Errors
Hock Leng PUAH
 
Connectivity Test for EES Logic Probe Project
Connectivity Test for EES Logic Probe ProjectConnectivity Test for EES Logic Probe Project
Connectivity Test for EES Logic Probe Project
Hock Leng PUAH
 

Mehr von Hock Leng PUAH (20)

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

Kürzlich hochgeladen

The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
heathfieldcps1
 
IATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdffIATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdff
17thcssbs2
 

Kürzlich hochgeladen (20)

The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
 
IATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdffIATP How-to Foreign Travel May 2024.pdff
IATP How-to Foreign Travel May 2024.pdff
 
Mbaye_Astou.Education Civica_Human Rights.pptx
Mbaye_Astou.Education Civica_Human Rights.pptxMbaye_Astou.Education Civica_Human Rights.pptx
Mbaye_Astou.Education Civica_Human Rights.pptx
 
Morse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptxMorse OER Some Benefits and Challenges.pptx
Morse OER Some Benefits and Challenges.pptx
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
Post Exam Fun(da) Intra UEM General Quiz - Finals.pdf
Post Exam Fun(da) Intra UEM General Quiz - Finals.pdfPost Exam Fun(da) Intra UEM General Quiz - Finals.pdf
Post Exam Fun(da) Intra UEM General Quiz - Finals.pdf
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceutics
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17
 
“O BEIJO” EM ARTE .
“O BEIJO” EM ARTE                       .“O BEIJO” EM ARTE                       .
“O BEIJO” EM ARTE .
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
philosophy and it's principles based on the life
philosophy and it's principles based on the lifephilosophy and it's principles based on the life
philosophy and it's principles based on the life
 
How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17
 
factors influencing drug absorption-final-2.pptx
factors influencing drug absorption-final-2.pptxfactors influencing drug absorption-final-2.pptx
factors influencing drug absorption-final-2.pptx
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptxREPRODUCTIVE TOXICITY  STUDIE OF MALE AND FEMALEpptx
REPRODUCTIVE TOXICITY STUDIE OF MALE AND FEMALEpptx
 
....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf....................Muslim-Law notes.pdf
....................Muslim-Law notes.pdf
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 

Calculator Processing

  • 1. Start Fresh Download from TPITVB.blogspot.com 2 1
  • 2. Start fresh Start VS 2005 and Create a new project: Calculator_IT1C_xx Choose appropriate directory and remember its path Exit VS 2005 Unzip start_cal.zip: Form1.vb and Form1.Designer.vb Use File explorer to replace the two newly created project files in Calculator_IT1C_xx
  • 3. ButtonSqrt_Click Double click on the button for Sqrt to generate the ButtonSqrt_Click subroutine Copy the codes from ButtonEqual_Click Modify the following line to use Math.Sqrt total = total + x total = Math.Sqrt(x)
  • 4. ButtonPercent_Click Double click on the button for % to generate the ButtonPercent_Click subroutine Copy the codes from ButtonEqual_Click Modify the following line to use Math.Sqrt total = total + x total = x / 100
  • 5. Dot Private 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 If End Sub “.”
  • 6. Testing 1.5 OK 0.5 NG => How?
  • 7. Dot Private Sub ButtonDot_Click ‘ Add else condition ‘ to add “0.” Dim existingString As String = TextBox1.Text If existingString <> "" Then TextBox1.Text = existingString & “.” End If End Sub Else TextBox1.Text = existingString & “0.” End If End Sub
  • 8. Testing 1.5 OK 0.5 OK 1.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. Dot Global variable: Public Class Form1 Dim isDotted As Boolean = False
  • 11. Dot Private Sub ButtonDot_Click ‘ Add Condition to check for isDotted Dim existingString As String = TextBox1.Text If existingString <> "" Then TextBox1.Text = existingString & “.” Else TextBox1.Text = existingString & “0.” End If End Sub If isDotted = False Then isDotted= True ‘ Set isDotted to True End If End Sub
  • 12. Testing 1.5 OK 0.5 OK 1.5.5. OK 1.5 Clear 1.5 => NG - How?
  • 13. Dot Private Sub ButtonClear_Click : : ‘ Reset isDotted to False isDotted = False End Sub
  • 14. Testing 1.5 OK 0.5 OK 1.5.5. OK 1.5 Clear 1.5 OK 1.5 + 1.5 => NG – How?
  • 15. Dot Private Sub ButtonPlus_Click : : ‘ Reset isDotted to False isDotted = False End Sub
  • 16. Testing 1.5 OK 0.5 OK 1.5.5. OK 1.5 Clear 1.5 OK 1.5 + 1.5 OK Anymore cases?
  • 17. Minus, Multiply and Divide Before 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 Equal Private Sub ButtonPlus_Click : : total = total + x : End Sub total = x ‘ Now, Plus can only be ‘ pressed once.
  • 19. Modify Plus and Equal Global variable: Public Class Form1 Dim whatFunction As String = “None”
  • 20. Modify Plus and Equal Private Sub ButtonPlus_Click : : whatFunction = “Plus” End Sub
  • 21. Modify Plus and Equal Private Sub ButtonEqual_Click : : total = total + x : End Sub Select Case whatFunction Case “Plus” total = total + x End Select Case “Minus”
  • 22. Add Minus, Multiply and Divide Complete the processing for minus, multiply and divide. Take care of divide by zero error with if then else statement Do testingand debugging to take care of other errors