import java.util.Scanner; public class FactoradicTest { public static void main(String[] args) { System.out.println("Testing the Factoradic class..."); System.out.println(); Factoradic f1 = new Factoradic(463); System.out.println("f1 = " + f1 + " = " + f1.base10Value()); Factoradic f2 = new Factoradic("1:4:1:1:2:0:0"); System.out.println("f2 = " + f2 + " = " + f2.base10Value()); Factoradic f3 = f1.plus(f2); System.out.println("f1 + f2 = " + f3 + " = " + f3.base10Value()); Factoradic f4 = f1.times(f2); System.out.println("f1 * f2 = " + f4 + " = " + f4.base10Value()); System.out.println("f1" + (f1.equals(new Factoradic("3:4:1:0:1:0")) ? " == " : " != ") + "f2"); System.out.println("f2" + (f2.equals(new Factoradic("2:1:2:0")) ? " == " : " != ") + "2:1:2:0"); System.out.println("f1" + (f1.equals(Integer.parseInt("463")) ? " == " : " != ") + "\"463\""); // now print out the factoradic form for numbers in the user-input range a to z. // this last task is really just so that you can get a feel for "counting" in the // factoradic number system System.out.println(); System.out.println("Now enter two positive integers a and b separated by a space, "); System.out.println("and with b>a. After which the values from a to b inclusive "); System.out.println("will be listed in both base 10 and factoradic form"); Scanner scanner = new Scanner(System.in); int a = scanner.nextInt(); int z = scanner.nextInt(); scanner.close(); for (int i = a; i < z+1; i++) { Factoradic f = new Factoradic(i); System.out.println(f.base10Value() + " = " + f); } } }