예제 #1
0
        private void GcdButton_Click(object sender, EventArgs e)
        {
            int m = Convert.ToInt32(Integer1TextBox.Text);
            int n = Convert.ToInt32(Integer2TextBox2.Text);

            GcdLabel.Text = MathProblems.Gcd(m, n).ToString();
        }
예제 #2
0
        private void DayOfTheWeekButton_Click(object sender, EventArgs e)
        {
            string month = MonthComboBox.Text;
            int    day   = Convert.ToInt32(textBox1.Text);
            int    year  = Convert.ToInt32(DoomsdayYearTextBox.Text);

            DayOfTheWeekLabel.Text = MathProblems.Doomsday(month, day, year).ToString();
        }
예제 #3
0
        private void LinearEquationButton_Click(object sender, EventArgs e)
        {
            double a = Convert.ToDouble(LinearCoefficientTextBox.Text);
            double b = Convert.ToDouble(ConstantCoefficientTextBox.Text);
            double c = Convert.ToDouble(RightSideOfEquationTextBox.Text);

            LinearEquationLabel.Text = MathProblems.LinearEquationSolution(a, b, c).ToString();
        }
예제 #4
0
        private void DiscriminantButton_Click(object sender, EventArgs e)
        {
            double a = Convert.ToDouble(aTextBox.Text);
            double b = Convert.ToDouble(bTextBox.Text);
            double c = Convert.ToDouble(cTextBox.Text);

            DiscriminantLabel.Text = MathProblems.Discriminant(a, b, c).ToString();
        }
예제 #5
0
        private void DistanceButton_Click(object sender, EventArgs e)
        {
            double x1 = Convert.ToDouble(x1TextBox.Text);
            double y1 = Convert.ToDouble(y1TextBox.Text);
            double x2 = Convert.ToDouble(x2TextBox.Text);
            double y2 = Convert.ToDouble(y2TextBox.Text);

            DistanceLabel.Text = MathProblems.Distance(x1, y1, x2, y2).ToString();
        }
예제 #6
0
        private void LeapYearButton_Click(object sender, EventArgs e)
        {
            int year = Convert.ToInt32(YearTextBox.Text);

            LeapYearLabel.Text = MathProblems.IsLeapYear(year).ToString();
        }
예제 #7
0
        // All your event handlers should be placed in this region.
        // For the sake of clean organization, all other methods are placed in a separate class ('MathProblems').
        // The class was added by right-clicking on the project "Unit 1 Homework Assignment 3" and selecting
        // "Add > Class..." from the context menu.

        #endregion

        private void IsPrimeButton_Click(object sender, EventArgs e)
        {
            int n = Convert.ToInt32(IntegerTextBox.Text);

            PrimeAnswerLabel.Text = MathProblems.IsPrime(n).ToString();
        }