//-----------button click events-------------- private void btnEqual_Click(object sender, EventArgs e) { RomanNumber number1 = new RomanNumber(userInputNumber1); RomanNumber number2 = new RomanNumber(userInputNumber2); RomanNumber result; //MessageBox.Show(newNumber.Convert().ToString()); Equation newEquation = new Equation(userInputNumber1, userInputNumber2); if (_calcMode == "ADD") { result = new RomanNumber(newEquation.AddNumbers()); result.romanNum = result.convertToRoman(); txtCalcOutput.Text = result.romanNum; txtConvertedNumber.Text = result.Convert().ToString(); } else if (_calcMode == "SUBTRACT") { result = new RomanNumber(newEquation.SubtractNumbers()); result.romanNum = result.convertToRoman(); txtCalcOutput.Text = result.romanNum; txtConvertedNumber.Text = result.Convert().ToString(); } else if (_calcMode == "MULTIPLY") { result = new RomanNumber(newEquation.MultiplyNumbers()); result.romanNum = result.convertToRoman(); txtCalcOutput.Text = result.romanNum; txtConvertedNumber.Text = result.Convert().ToString(); //test MessageBox.Show(newEquation.MultiplyNumbers().ToString() + " test"); } else if (_calcMode == "DIVIDE") { result = new RomanNumber(newEquation.DivideNumbers()); result.romanNum = result.convertToRoman(); txtCalcOutput.Text = result.romanNum; txtConvertedNumber.Text = result.Convert().ToString(); } else { txtCalcOutput.Text = "ERR"; } }
//this method runs when a numeric button is clicked and the click event runs public void PressLetterButton(String b) { RomanNumber currNumber; if (isFirstNumber == true) { userInputNumber1 += b; currNumber = new RomanNumber(userInputNumber1); txtCalcOutput.Text = currNumber.romanNum; txtConvertedNumber.Text = currNumber.Convert().ToString(); currNumber.romanNum = string.Empty; } else if (isFirstNumber == false) { userInputNumber2 += b; currNumber = new RomanNumber(userInputNumber2); txtCalcOutput.Text = currNumber.romanNum; txtConvertedNumber.Text = currNumber.Convert().ToString(); currNumber.romanNum = string.Empty; } }
public int AddNumbers() { n1 = romanNumber1.Convert(); n2 = romanNumber2.Convert(); return(n1 + n2); }