my program won't even run so i must have missed something drastically but i don't see it....
anyway, Create a class called Factor that has a public method called calculateFactor. The method has two two arguments of type integer and checks whether the smaller of the two integers is a factor of the larger of the two integers. The method will return a factor or a zero. Write a main method which repeatedly reads in a positive integer n (exiting only when n is negative), and displays out the largest proper divisor of n (that is, the largest factor of n that is less than n itself).
This is what i have:
import java.io.*;
import java.util.*;
class Factor{
public int calculateFactor(int n1, int n2){
int factor =0;
if(factor==0)
return 0;
else {
return factor;
}//end public
}//end class
public class lab7_1 {
public void main(String[]args){
System.out.print("input an integer number:");
Factor f= new Factor();
int n;
n=0;
int i;
i=2;
double value;
value=f.calculateFactor(i,n);
while(i<=n)
System.out.print("largest divisor");
}
}
}