Question
Create a calculator program identical to the standard one included with MS Windows.
Verify that all of the buttons have appropriate names. The appropriate arithmetic answer should appear on the mantissa after the user presses a number, then an operator (i.e., +, -, *, /), then another number, and then the equals button. This step assumes that the user will only enter whole numbers (i.e., not real numbers). When C (i.e., the clear button) is clicked the mantissa must clear and any operations that were previously entered are also cleared. For example, if the user typed 1 + 2 and then pressed C, the variables that contain the 1 and the 2, in addition to the variable that contains the operator (in this case +) must be cleared. When CE (i.e., the clear entry button) is clicked the recent entry is cleared but not other previous operand or operator is to be cleared.When Backspace is clicked, the mantissa must reflect the accurate number. Make sure the sqrt, %, inverse, and sign change (i.e., +/-) buttons work correctly. Make sure the MC, MR, MS, M+ buttons work correctly as well as the menu options (just for the Edit menu).
Note
: Don’t worry about creating a menu (i.e., Edit, View, Help) for the calculator.
This is not a c++ problem. the following language should be used to complete the prog. u can use for or do while loop but no modulus!! and pls name the buttons!!
this is just an example:
Public Class Form1
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click
'declarations
Dim num1 As Integer
Dim num2 As Integer
'get user input
num1 = Convert.ToInt32(txtNum1.Text)
num2 = Convert.ToInt32(txtNum2.Text)
'output
lblResult.Text = Convert.ToString(myMax(num1, num2))
End Sub
Function myMax(ByVal num1Par As Integer, ByVal num2Par As Integer) As
Integer
Return Math.Max(num1Par, num2Par)
End Function
End Class
Explanation / Answer
the program in VB PLEASE RATE Dim Enrico, Lorenzo, MEM, dot, pressequaltrue Dim equalpress, CALOFF, PERCENT, valpercent Private Sub About_Click() Form2.Show End Sub Private Sub Check1_Click() If Check1.Value = 0 Then Form1.Height = 3555 Form1.BackColor = &H8000000F Label2.ForeColor = vbBlack Else If HScroll1.Value + HScroll2.Value + HScroll3.Value 1 Then If Lorenzo = 1 Then If PERCENT = 1 Then txtdisplay = Enrico + valpercent Else txtdisplay = Enrico + Val(txtdisplay) End If ElseIf Lorenzo = 2 Then If PERCENT = 1 Then txtdisplay = Enrico - valpercent Else txtdisplay = Enrico - Val(txtdisplay) End If ElseIf Lorenzo = 3 Then If PERCENT = 1 Then txtdisplay = Enrico * valpercent Else txtdisplay = Enrico * Val(txtdisplay) End If ElseIf Lorenzo = 4 Then If PERCENT = 1 Then txtdisplay = Enrico / valpercent Else txtdisplay = Enrico / Val(txtdisplay) End If End If Lorenzo = 0 pressequaltrue = 0 dot = 0 PERCENT = 0 End If If CALOFF = 0 Then txtdisplay.SetFocus End If equalpress = 1 End Sub Private Sub cmdMinus_Click() Enrico = Val(txtdisplay) txtdisplay = "" Lorenzo = 2 dot = 0 pressequaltrue = 1 If CALOFF = 0 Then txtdisplay.SetFocus End If End Sub Private Sub cmdMultiply_Click() Enrico = Val(txtdisplay) txtdisplay = "" Lorenzo = 3 dot = 0 pressequaltrue = 1 If CALOFF = 0 Then txtdisplay.SetFocus End If End Sub Private Sub cmdPlus_Click() Enrico = Val(txtdisplay) txtdisplay = "" Lorenzo = 1 dot = 0 pressequaltrue = 1 If CALOFF = 0 Then txtdisplay.SetFocus End If End Sub Private Sub cmdPoint_Click() If txtdisplay = "" Or equalpress = 1 Then txtdisplay = "0" End If If dot = 0 Then txtdisplay = txtdisplay + "." dot = 1 End If equalpress = 0 If CALOFF = 0 Then txtdisplay.SetFocus End If End Sub Private Sub Command1_Click() If CALOFF = 0 Then If Not Val(txtdisplay) = 0 Then MEM = txtdisplay lblMemory.Caption = "M" End If End If If CALOFF = 0 Then txtdisplay.SetFocus End If End Sub Private Sub Command2_Click() txtdisplay = MEM equalpress = 1 dot = 0 If CALOFF = 0 Then txtdisplay.SetFocus End If End Sub Private Sub Command3_Click() lblMemory = "" MEM = "" MC = 1 If CALOFF = 0 Then txtdisplay.SetFocus End If End Sub Private Sub Command4_Click() Form1.Height = 3555 If CALOFF = 0 Then txtdisplay.SetFocus End If End Sub Private Sub Command5_Click() If equalpress = 0 Then txtdisplay = Val(txtdisplay) - 2 * Val(txtdisplay) dot = 0 End If If CALOFF = 0 Then txtdisplay.SetFocus End If End Sub Private Sub Command6_Click() If pressequaltrue > 1 Then txtdisplay = (Val(txtdisplay) / 100) * Enrico valpercent = Val(txtdisplay) PERCENT = 1 pressequaltrue = 0 End If If CALOFF = 0 Then txtdisplay.SetFocus End If End Sub Private Sub Command7_Click() If equalpress = 0 Then txtdisplay = Val(txtdisplay) * Val(txtdisplay) equalpress = 1 End If If CALOFF = 0 Then txtdisplay.SetFocus End If End Sub Private Sub Cpy_Click() Clipboard.Clear Clipboard.SetText txtdisplay Pste.Enabled = True End Sub Private Sub Form_Load() Form1.BackColor = &H8000000F End Sub Private Sub HScroll1_Change() If HScroll1.Value + HScroll2.Value + HScroll3.Value