Question: Add memory capability to your calculator. Add 2 new components to the Calculator. Add a Label and another Button. Leave the Label blank, and put
Add memory capability to your calculator. Add new components to the Calculator. Add a Label and another Button. Leave the Label blank, and put an M on the Button. When the user clicks the M button, the contents of the Answer TextBox should be copied to a memory variable. Also make it so that when the user moves the mouse over the label, the value in the memory variable will appear in this label, and then disappear, when the mouse moves away from the label. Also add one more button, an M button. When the user clicks this button, the contents of the Results box will be added to Memory. You will need to use a Global Variable to store this data.
Here is my code so far
namespace SimpleCalculator
public partial class SimpleCalculator: UserControl
public SimpleCalculator
InitializeComponent;
private void ExitButtonClickobject sender EventArgs e
Application.Exit;
private void additionRadioButtonCheckedChangedobject sender EventArgs e
private void CalculateButtonClickobject sender EventArgs e
double num num result;
if doubleTryParsenumberTextbox.Text, out num && double.TryParsenumberTextbox.Text, out num
if additionRadioButtonChecked
result num num;
else if subtractionRadioButtonChecked
result num num;
else if multiplicationRadioButtonChecked
result num num;
else if divisionRadioButtonChecked
if num
result num num;
else
MessageBox.ShowDivision by zero is not allowed.";
return;
else
MessageBox.ShowPlease select an operation.";
return;
resultTextbox.Text result.ToString;
else
MessageBox.ShowInvalid input. Please enter valid numbers.";
private void ClearButtonClickobject sender EventArgs e
numberTextbox.Clear;
numberTextbox.Clear;
resultTextbox.Clear;
private void clearToolStripMenuItemClickobject sender EventArgs e
numberTextbox.Clear;
numberTextbox.Clear;
resultTextbox.Clear;
private void exitToolStripMenuItemClickobject sender EventArgs e
Application.Exit;
private void colorToolStripMenuItemClickobject sender EventArgs e
ColorDialog colorDialog new ColorDialog;
if colorDialogShowDialog DialogResult.OK
this.BackColor colorDialog.Color;
private void aboutToolStripMenuItemClickobject sender EventArgs e
MessageBox.ShowThis is an about textbox. Making this calculator was difficult but fun!";
private void fileMenuItemClickedobject sender ToolStripItemClickedEventArgs e
private void ForLoopButtonClickobject sender EventArgs e
for int i ; i ; i
Console.WriteLineGo Falcons!";
private void WhileLoopButtonClickobject sender EventArgs e
int i ;
while i
Console.WriteLineGo Falcons!";
i;
private void MButtonClickobject sender EventArgs e
private void memoryLabelMouseEnterobject sender EventArgs e
private void memoryLabelMouseLeaveobject sender EventArgs e
private void MPlusButtonClickobject sender EventArgs e
private void SimpleCalculatorLoadobject sender EventArgs e
private void memoryLabelClickobject sender EventArgs e
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
