Beispiel #1
0
        // The button1_click method
        // Purpose: take the length of both sides and put them in variables, then return the method CalcHypotenuse to output the Hypotenuse.
        // Parameters: The sending object, and the event arguments
        // returns: none
        private void button1_Click(object sender, EventArgs e)
        {
            //convert the input boxes from string to double
            double sideAValue = double.Parse(sideA.Text);
            double sideBValue = double.Parse(sideB.Text);

            //save the values of sideB and sideC in the the Triangle Object
            tc = new Triangle(sideAValue, sideBValue);
            //call back the method for calculating sideC
            double siceCValue = tc.CalcSideC();
            //convert to string and place it in its own variable
            string sideCOutStr = $"{siceCValue}";

            //output the string to the output box
            sideC.Text = sideCOutStr;
        }