i have to take a supplied program and add a GUI to it, but I'm not allowed to directly modify it in any way.
I've created the GUI, but how do i make it take on the values from the original program, and all of that good stuff?
System.out.println("Enter an integer"); //scanner class Scanner console = new Scanner(System.in); int n = console.nextInt(); int dr = 0;//declared digital root variable int m = 0; // declared m //check A non-negative integer if (n <= 0) { System.out.println("Only positive numbers please!"); } else { //manual summing of digits if (m >= 9 && m <= 1) { dr = n; } else { m = (1 + (n - 1) % 9); dr=m; } System.out.println("The digital root of " + n + " is " + dr); // }
I've created the GUI, but how do i make it take on the values from the original program, and all of that good stuff?