95.2k views
0 votes
Design and implement a GUI application that uses text fields to obtain two integer values (one text field for each value) along with a button named "display" to display the sum and product of the values. Assume that the user always enters valid integer values as inputs.

User Mirko Jahn
by
7.1k points

1 Answer

3 votes

Answer:

Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Dim sum, product, num1, num2 As Integer

num1 = Val(TextBox1.Text)

num2 = Val(TextBox2.Text)

sum = num1 + num2

product = num1 * num2

TextBox3.Text = sum

TextBox4.Text = product

End Sub

End Class

  • Step-by-step explanation:
  • The solution is implemented in Visual Basic Programming Language
  • Two textboxes are created to receive the user's input and two textboxes for displaying sum and product respectively
  • Each of these controls are appropriately labeled (See the attached GUI interface)
  • The Sum is calculated by adding the values from textbox1 and 2
  • The product is calculated by multiplying both
Design and implement a GUI application that uses text fields to obtain two integer-example-1
User Jason Kealey
by
7.3k points