static void Main(string[] args) { Rational r1 = new Rational(); r1.Show(); Rational r2 = new Rational(5); r2.Show(); Rational r3 = new Rational(6, 7); r3.Show(); r3.SetGet_num = 11; Console.WriteLine(r3.SetGet_num); Console.WriteLine(r3.Get_deno); Console.Read(); }
static void Main(string[] args) { /* * BankAccount accountA = new BankAccount("001","AAA"); * BankAccount accountB = new BankAccount("002", "BBB"); * accountA.Deposit(3000.00); * accountA.Withdraw(100.00); * accountA.TransferTo(500.00, accountB); * accountA.ShowBalance(); * accountB.ShowBalance(); */ Rational.Rational a = new Rational.Rational(3, 4); Rational.Rational b = new Rational.Rational(4, 5); Rational.Rational c = a.Add(b); Console.WriteLine(c.StrVal()); c = b.Subtract(a); Console.WriteLine(c.StrVal()); }
public Rational(Rational r1) { this.dividend = r1.dividend; this.divisor = r1.divisor; }