0
저는 타원 곡선을 포함한 작은 개인 프로젝트를 진행하고 있습니다. 커브의 인스턴스 변수에 약간의 어려움이 있습니다. 변수는 main 메서드에서 올바르게 인쇄되지만 print 메서드는 항상 각 변수가 0과 같다고 반환합니다. 누구나이 문제를 해결할 방법을 알고 있습니까? 제발 저를 참아주십시오. 저는 이것이 사소한 문제라는 것을 압니다.간단한 인스턴스 변수 문제
public class ellipticcurve {
public int A, B, p;
public ellipticcurve(int A, int B, int p) {
A = this.A;
B = this.B;
p = this.p;
// E:= Y^2 = X^3 + AX + B
}
public static boolean isAllowed(int a, int b, int p) {
return ((4*(Math.pow(a, 3)) + 27*(Math.pow(b, 2)))%p != 0);
}
public static void printCurve(ellipticcurve E) {
System.out.println("E(F" + E.p + ") := Y^2 = X^3 + " + E.A + "X + " + E.B + ".");
}
public static void main(String[] args) {
ArgsProcessor ap = new ArgsProcessor(args);
int a = ap.nextInt("A-value:");
int b = ap.nextInt("B-value:");
int p = ap.nextInt("Prime number p for the field Fp over which the curve is defined:");
while (isAllowed(a, b, p) == false) {
System.out.println("The parameters you have entered do not satisfy the "
+ "congruence 4A^3 + 27B^2 != 0 modulo p.");
a = ap.nextInt("Choose a new A-value:");
b = ap.nextInt("Choose a new B-value:");
p = ap.nextInt("Choose a new prime number p for the field Fp over which the curve is defined:");
}
ellipticcurve curve = new ellipticcurve(a, b, p);
System.out.println(curve.A + " " + curve.B + " " + curve.p);
printCurve(curve);
System.out.println("The elliptic curve is given by E(F" + p
+ ") := Y^2 = X^3 + " + a + "X + " + b + ".");
}
, 감사합니다! 그런 작은 실수 – wucse19