本週增長的分數計算部分git
public fenshu add(fenshu op2) { int commonDenominator = denominator * op2.getDenominator(); int numerator1 = numerator * op2.getDenominator(); int numerator2 = op2.getNumerator() * denominator; int sum = numerator1 + numerator2; System.out.print("("+this.toString()+")" + " + " + "("+op2.toString()+")" + "="); return new fenshu (sum, commonDenominator); } public fenshu subtract(fenshu op2) { int commonDenominator = denominator * op2.getDenominator(); int numerator1 = numerator * op2.getDenominator(); int numerator2 = op2.getNumerator() * denominator; int difference = numerator1 - numerator2; System.out.print("("+this.toString()+")" + " - " + "("+op2.toString()+")" + "="); return new fenshu(difference,commonDenominator); } public fenshu multiply (fenshu op2) { int numer = numerator * op2.getNumerator(); int denom = denominator * op2.getDenominator(); System.out.print("("+this.toString()+")" + " * " + "("+op2.toString()+")" + "="); return new fenshu (numer, denom); } public fenshu divide (fenshu op2) { fenshu op1 = op2.reciprocal(); int numer = numerator * op1.getNumerator(); int denom = denominator * op1.getDenominator(); System.out.print("("+this.toString()+")" + " / " + "("+op2.toString()+")" + "="); return new fenshu (numer, denom);
碼雲連接編程
我與李天林同窗的相處依然很是融洽,代碼編寫的過程也是兩人一塊兒努力構思、努力實現的結果。沒有什麼特別須要改進的地方,望繼續保持。ide
步驟 | 耗時 | 百分比 |
---|---|---|
學習相關思路 | 100min | 27.7% |
設計程序思路 | 60min | 16.6% |
代碼實現 | 100min | 27.7% |
bug調試 | 80min | 22.2% |
博客總結 | 20min | 5.5% |