public Fraction subtraction(Fraction FractionObj) { int den = SimpleNums.getInstance().NOK(Denomenator, FractionObj.getDenomenator()); int num = Numerator * (den / Denomenator); int num2 = FractionObj.getNumerator() * (den / FractionObj.getDenomenator()); return new Fraction((num - num2), den); }
public static SimpleNums getInstance(int MaxValue=100000) { if (instance == null) { instance = new SimpleNums(MaxValue); } return instance; }
// метод упрощения дроби protected void simplify() { int FractionNOD = SimpleNums.getInstance().NOD(Numerator, Denomenator); Numerator = Numerator / FractionNOD; Denomenator = Denomenator / FractionNOD; }
private void Form1_Activated(object sender, EventArgs e) { SimpleNums.getInstance(); }