I'm trying to finish the following program. It is supposed to read a number from a data file and find whether the number is perfect, deficient, or abundant. The proper divisors are supposed to be included in the output and tha data file must have 10 numbers.
// Lleachl3.java
import java.io.*;
public class Lleachl3 { public static void main(String args[]) throws IOException {
sum = 0; System.out.print(num); for (int x = 1; x < num; x++) { if (num is divisible by x) { System.out.print(Lutil.format(x,14)); x is added to sum; }
} System.out.print(Lutil.s(16)); if (sum = num) { System.out.print("Perfect"); } else if (sum < num) { System.out.print("Deficient"); } else System.out.print ("Abundant");
Lutil.s(); Lutil.l(); }
} // ******************** End of Void Main *******************************
/* * ************************* Helper Methods Go Here **************************** */
Oh, Lutil is a file that my computer teacher has us use to format our programs.
Thanks for your help. It's still not working yet, but it's closer (it's saying all the numbers are abundant). Guess I'll just have to play around with it a bit.