3
5 + 4 total (global) TextBox1.Text Processing in each of the button 0 blank 5 TextBox1.Text = TextBox1.Text & "5" 0 5 + total = CDbl(TextBox1.Text) TextBox1.Text = "" 5 blank 4 TextBox1.Text = TextBox1.Text & "4" 5 4 = TextBox1.Text = Cstr(total + CDbl(TextBox1.Text)) total = 0 0 9 5 - 4 total (global) TextBox1.Text Processing 0 blank 5 TextBox1.Text = TextBox1.Text & "5" 0 5 - total = CDbl(TextBox1.Text) TextBox1.Text = "" 5 blank 4 TextBox1.Text = TextBox1.Text & "4" 5 4 = TextBox1.Text = Cstr(total - CDbl(TextBox1.Text)) total = 0 0 1 Use a global variable to relay the + operation Use a global variable to relay the - operation

Calculator Processing

Embed Size (px)

Citation preview

Page 1: Calculator Processing

5 + 4

total

(global)

TextBox1.Text Processing in each of the button

0 blank 5 TextBox1.Text = TextBox1.Text & "5" 0 5 + total = CDbl(TextBox1.Text)

TextBox1.Text = "" 5 blank 4 TextBox1.Text = TextBox1.Text & "4" 5 4 = TextBox1.Text = Cstr(total + CDbl(TextBox1.Text))

total = 0 0 9

5 - 4

total

(global)

TextBox1.Text Processing

0 blank 5 TextBox1.Text = TextBox1.Text & "5" 0 5 - total = CDbl(TextBox1.Text)

TextBox1.Text = "" 5 blank 4 TextBox1.Text = TextBox1.Text & "4" 5 4 = TextBox1.Text = Cstr(total - CDbl(TextBox1.Text))

total = 0 0 1

Use a

global

variable

to relay

the +

operation

Use a

global

variable

to relay

the -

operation

Page 2: Calculator Processing

5 * 4

total

(global)

TextBox1.Text Processing

0 blank 5 TextBox1.Text = TextBox1.Text & "5" 0 5 * total = CDbl(TextBox1.Text)

TextBox1.Text = "" 5 blank 4 TextBox1.Text = TextBox1.Text & "4" 5 4 = TextBox1.Text = Cstr(total * CDbl(TextBox1.Text))

total = 0 0 20

5 ÷ 4

total

(global)

TextBox1.Text Processing

0 blank 5 TextBox1.Text = TextBox1.Text & "5" 0 5

÷÷÷÷ total = CDbl(TextBox1.Text) TextBox1.Text = ""

5 blank 4 TextBox1.Text = TextBox1.Text & "4" 5 4 = TextBox1.Text = Cstr(total / CDbl(TextBox1.Text))

total = 0 0 1.25

Use a

global

variable

to relay

the *

operation

Use a

global

variable

to relay

the /

operation

Page 3: Calculator Processing

25 Sqrt

total

(global)

TextBox1.Text Processing

0 blank 25 TextBox1.Text = TextBox1.Text & "25" 0 25

Sqrt TextBox1.Text = CStr(Math.Sqrt(Cdbl(TextBox1.Text)))

0 5

25 %

total

(global)

TextBox1.Text Processing

0 blank 25 TextBox1.Text = TextBox1.Text & "25" 0 25 % TextBox1.Text = CStr(Cdbl(TextBox1.Text) / 100 )

0 0.25