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;
	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;
int i;
double value;
System.out.print("largest divisor");

9 Years
Discussion Span
Last Post by stephen84s

my program won't even run so i must have missed something drastically but i don't see it....

Excellent analysis of the problem, also let me congratulate you on the wonderful code alignment technique you have pioneered.
Also do not directly copy paste your assignment.

Here are a few pointers you need to look into

  1. while and do while loops in Java - Look here.
  2. Reading an Integer from Console in Java
  3. Sun Java Code Conventions, no need to read the whole document, just go through the basic parts related to code indentation, variable naming etc.

And Vernon already has pointed out the "main" part

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.