Exemplo n.º 1
0
        public myFraction Multi(myFraction other)
        {
            myFraction result = new myFraction(1, 1);

            result.numerator   = this.numerator * other.numerator;
            result.denominator = this.denominator * other.denominator;
            return(result);
        }
Exemplo n.º 2
0
        public myFraction Amount(myFraction other)
        {
            myFraction result = new myFraction(0, 0);

            if (this.denominator == other.denominator)
            {
                result.numerator   = this.numerator + other.numerator;
                result.denominator = this.denominator;
            }
            if (this.denominator != other.denominator)
            {
                result.numerator   = this.numerator * other.denominator + other.numerator * this.denominator;
                result.denominator = this.denominator * other.denominator;
            }
            return(result);
        }
Exemplo n.º 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            myFraction fract3 = new myFraction(Convert.ToInt32(textBox2.Text), Convert.ToInt32(textBox3.Text));

            textBox1.Text += fract3.ToString() + "\r\n";
        }
Exemplo n.º 4
0
        private void button2_Click(object sender, EventArgs e)
        {
            myFraction fract2 = new myFraction(2);

            textBox1.Text += fract2.ToString() + "\r\n";
        }