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 so far, i am getting errors with the factor f=new factor() and defining n. Also in the classFactor i think im making a mistake even though its not giving me any errors, can u guys help me out.

import java.io.*;

import java.util.*;

class Factor{

public int calculateFactor(int n1, int n2){

public Factor newFactor()

int factor;

factor=n2%n1;

if(factor==0)

return factor;

else {

return 0;

}//end public

}//end class

public class lab7_1 {

public int main(String[]args){

System.out.print("input an integer number:");

Factor f= newFactor();

int n;

n=in.nextInt();

int i;

i=2;

while(i<=n)

calculateFactor(i,n);

System.out.print("largest divisor");

}

}