CMPT110_Assignment04

CMPT110_Assignment04 - CMPT 110 Assignment 4 (1% of final...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CMPT 110 – Assignment 4 (1% of final grade) Due: Wednesday, October 15 th , in class Late assignments will not be accepted. What to hand in : a print-out of your code for question 1, and for questions 2-6, a print-out of your code, and one screenshot of your program. 1. [25 marks] Rewrite the following code fragments to reduce the amount of repeated code. You can do this by writing an extra function or subroutine and then calling that function / subroutine. a. Private Sub button_Click() Dim p As String = TextBox1.Text Dim q As String = TextBox2.Text Dim result As String TextBox3.Text = result End Sub Private Sub button2_Click() Dim s As String = TextBox1.Text Dim t As String = TextBox2.Text Dim result As String TextBox3.Text = result End Sub b. Private Sub button3_Click . .. Dim x As Decimal = 5 Dim y As Decimal = 10 Dim z As Decimal = 15 Dim answer1 As Decimal = Math.Pow(2 * x, y) + Math.Sqrt(z) Dim a As Decimal = 8 Dim b As Decimal = 12 Dim c As Decimal = 16
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/12/2011 for the course CMPT 110 taught by Professor Andrew during the Fall '10 term at Simon Fraser.

Page1 / 2

CMPT110_Assignment04 - CMPT 110 Assignment 4 (1% of final...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online