Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: calculate the factors of a positive integer number

  1. #1
    Junior Member
    Join Date
    Mar 2014
    My Mood
    Thanked 0 Times in 0 Posts

    Default calculate the factors of a positive integer number

    lines 7, 8, &12 "primes" are underline in red (prime cannot be resolved) is what pops up when i hover over the x's.
    i don't get why that is.

    package assignment7;
    public class Exercise3 
    	public static void main(String[] args) 
    		for (int p = Primes.next(); p < 30; p = Primes.next()) 
    			int n = (int)Math.round(Math.pow(2,p)) - 1;
    			System.out.printf("%d\t2^%d-1%d", p, p, n);
    		if (Primes.isPrime(n)) 
    			System.out.println(" is prime ");
    		} else 
    			System.out.println(" is not prime ");

  2. #2
    Join Date
    Feb 2014
    Thanked 48 Times in 45 Posts

    Default Re: calculate the factors of a positive integer number

    This means the class/object Prime and Primes cannot be found. You may need to write them yourself, or they may have already been provided to you.

    Cross-posted at http://www.java-forums.org/new-java/...er-number.html
    Last edited by jashburn; March 16th, 2014 at 07:52 PM. Reason: Add cross-post URL

  3. The Following User Says Thank You to jashburn For This Useful Post:

    ATB (March 16th, 2014)

Similar Threads

  1. display all prime factors of a number
    By mia_tech in forum What's Wrong With My Code?
    Replies: 5
    Last Post: May 18th, 2012, 06:55 PM
  2. It is possible that not using array to list the positive integer <100??
    By lim131 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 15th, 2012, 10:52 AM
  3. Replies: 8
    Last Post: April 14th, 2012, 12:24 PM
  4. The sum and product of a positive number between 1000 and 9999.
    By metaleddie13 in forum Member Introductions
    Replies: 1
    Last Post: September 15th, 2011, 04:39 AM
  5. check if a number is an integer
    By rsala004 in forum Java Theory & Questions
    Replies: 3
    Last Post: August 15th, 2009, 03:51 PM

Tags for this Thread