20165219 2017-2018-2 "Java programming" pair programming first week summary pair object
20165219 Wang Yanbo
20165232 He Yanda
Demand analysis
Implement a program that requires:
1 Support for integer operations
2 support for multi-operator operations
3 support fractional operation, support true fractional operation
3 statistic correct rate
Expansion requirements:
Design ideas
This is a program that needs to support complex operations, unlike simple single-operator arithmetic, you need to design multiple classes to implement operations such as subtraction and squared operations.
NML Chart (partial)
Code Progress
Integer Calculation class
public class IntNumber { private int A; public int getA(){ return A; } public IntNumber(int A){ this.A = A; } public int add(IntNumber op1){ int sum = A + op1.A; System.out.print(A + " + " + op1.A + "="); return sum; } public int subtract(IntNumber op1){ int num = A - op1.A; System.out.print(A + " - " + op1.A + "="); return num; } public int multiply(IntNumber op1){ int num = A * op1.A; System.out.print(A + " * " + op1.A + "="); return num; } public static IntNumber obj(){ Random ran = new Random(); return new IntNumber(ran.nextInt(20)-10); } public String divide(Score op1){ System.out.print(op1.getNumerator() + " / " + op1.getDenominator() + "="); return op1.toString(); }}
Code Cloud Hosting
Function
Test of normal boundary anomaly
Knot to feel
Pair learning or need to have a clear division of labor to play a multiplier effect, through this week's knot to learn, you can feel the effect of 1+1>2.
20165219 2017-2018-2 "Java programming" a first week summary of pair programming