Thursday, October 22, 2015

Generational Gauss Class

We can define a generational Gauss class by changing three lines of this Java code. We add a generational parameter n to the class constructor. That is we replace the line

public Gauss(int year, boolean g)

by the line

public Gauss(int year, boolean g, int n)

We replace the line

private static final double m0 = T - 10. * K + L + 14.;

by the line

double m0 = T - (10. + n)* K + L + 14.;

and move it down to below the constructor. Lastly, we change the line

a = (12 * year + 17) % 19;

into

a = (12 * year + 17 + n)% 19;

Then generational Gauss objects.with the third parameter 0 are "equal" to the original objects. Generational Gauss objects with third parameter 5 are "equal" to changed Gauss objects specified here. Generational Gauss objects with third parameter 4 are "equal" to the changed Gauss objects hinted to here.

Finally, here is the complete Java program that prints the output of the previous post, with the generational Gauss class.