You will create a very simple two numbers calculator with save options; here is
ID: 3530812 • Letter: Y
Question
You will create a very simple two numbers calculator with save options; here is the specifications for the application. Create a form divided vertically in two halves with right and left panels 1- In the left panel you will create the following control, the label or the value of the control will be in "" and the type of the control will in [] a- "First Number" [textbox] b- "Second number" [texbox] c- "Result" [textbox] - read only d- "+" [push button] "-" [push button] "/" [push button] "*" [push button] f- "Save" [push button] "Display" [push button] 2- Operations The user will enter two numbers in the "First Number" and the "Second Number", then press the "+" for addition, "-" for subtraction, "*" multiplication and "/" the result will be displayed in the result [textbox], if the user clicked "[save]" then the operation can be displayed in the right panel when the user press [Display] Please note that the user can save up to 10 operations. Add "clear" [push button] on the right panel to clear the content, make sure that you trap all the errors and set the focus to the appropriate control after the error occurred - Make sure that the result contains the operations, I should see in the right panel something like this 1+1=2 1*2=2 and so on. - You must trap dived by Zero and a display a message to the userExplanation / Answer
Public Class Form1 Dim Num1 As Decimal Dim Num2 As Decimal Dim Num3 As Decimal Private Sub ButtonAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAdd.Click Num1 = TextBoxNum1.Text Num2 = TextBoxNum2.Text Num3 = Num1 + Num2 TextBoxNum3.Text = Num3 End Sub Private Sub ButtonSubtract_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSubtract.Click Num1 = TextBoxNum1.Text Num2 = TextBoxNum2.Text Num3 = Num1 - Num3 TextBoxNum3.Text = Num3 End Sub Private Sub ButtonMultiply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonMultiply.Click Num1 = TextBoxNum1.Text Num2 = TextBoxNum2.Text Num3 = Num1 * Num2 TextBoxNum3.Text = Num3 End Sub Private Sub ButtonDivide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDivide.Click Num1 = TextBoxNum1.Text Num2 = TextBoxNum2.Text Num3 = Num1 / Num2 TextBoxNum3.Text = Num3 End Sub
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.