<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'I need help!!!  I need to make a FactorGenerator' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'I need help!!!  I need to make a FactorGenerator' posted on the 'Java' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Tue, 18 Jun 2013 14:04:41 -0700</pubDate>
    <lastBuildDate>Tue, 18 Jun 2013 14:04:41 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>I need help!!!  I need to make a FactorGenerator</title>
      <link>http://www.programmersheaven.com/mb/java/332534/332534/i-need-help--i-need-to-make-a-factorgenerator/</link>
      <description>Hi,&lt;br /&gt;
I have a program to write for a chapter on loops and I have no clue where to start. I have to write a program that take in an int and prints the factors of the numbers.&lt;br /&gt;
&lt;br /&gt;
example:&lt;br /&gt;
&lt;br /&gt;
Please enter a number : 12&lt;br /&gt;
1&lt;br /&gt;
3&lt;br /&gt;
4&lt;br /&gt;
12&lt;br /&gt;
&lt;br /&gt;
If you guys can help i would really appreciate it. Thanks.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java/332534/332534/i-need-help--i-need-to-make-a-factorgenerator/</guid>
      <pubDate>Mon, 20 Mar 2006 00:16:51 -0700</pubDate>
      <category>Java</category>
    </item>
    <item>
      <title>Re: I need help!!!  I need to make a FactorGenerator</title>
      <link>http://www.programmersheaven.com/mb/java/332534/332544/re-i-need-help--i-need-to-make-a-factorgenerator/#332544</link>
      <description>: Hi,&lt;br /&gt;
: I have a program to write for a chapter on loops and I have no clue where to start. I have to write a program that take in an int and prints the factors of the numbers.&lt;br /&gt;
: &lt;br /&gt;
: example:&lt;br /&gt;
: &lt;br /&gt;
: Please enter a number : 12&lt;br /&gt;
: 1&lt;br /&gt;
: 3&lt;br /&gt;
: 4&lt;br /&gt;
: 12&lt;br /&gt;
: &lt;br /&gt;
: If you guys can help i would really appreciate it. Thanks.&lt;br /&gt;
: &lt;br /&gt;
Use a for-loop to loop through the numbers until the loop reaches the number. You can check if a certain number is a factor of the entered int, by using the %-operator. The %-operator gives you the remainder of the division. Thus if a certain number is a factor of the entered int, then the remainder will be equal to 0.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java/332534/332544/re-i-need-help--i-need-to-make-a-factorgenerator/#332544</guid>
      <pubDate>Mon, 20 Mar 2006 01:58:09 -0700</pubDate>
      <category>Java</category>
    </item>
    <item>
      <title>Re: I need help!!!  I need to make a FactorGenerator</title>
      <link>http://www.programmersheaven.com/mb/java/332534/332547/re-i-need-help--i-need-to-make-a-factorgenerator/#332547</link>
      <description>: : Hi,&lt;br /&gt;
: : I have a program to write for a chapter on loops and I have no clue where to start. I have to write a program that take in an int and prints the factors of the numbers.&lt;br /&gt;
: : &lt;br /&gt;
: : example:&lt;br /&gt;
: : &lt;br /&gt;
: : Please enter a number : 12&lt;br /&gt;
: : 1&lt;br /&gt;
: : 3&lt;br /&gt;
: : 4&lt;br /&gt;
: : 12&lt;br /&gt;
: : &lt;br /&gt;
: : If you guys can help i would really appreciate it. Thanks.&lt;br /&gt;
: : &lt;br /&gt;
: Use a for-loop to loop through the numbers until the loop reaches the number. You can check if a certain number is a factor of the entered int, by using the %-operator. The %-operator gives you the remainder of the division. Thus if a certain number is a factor of the entered int, then the remainder will be equal to 0.&lt;br /&gt;
: &lt;br /&gt;
this is what i got so far but it still doesn't work. i can't get the any number to print except for 0;&lt;br /&gt;
my book says i have to use the nextFactor method and the hasNextFactor method and that it has to print this way&lt;br /&gt;
example:&lt;br /&gt;
150&lt;br /&gt;
2&lt;br /&gt;
3&lt;br /&gt;
5&lt;br /&gt;
5&lt;br /&gt;
if you could help me with this I would really appreciate it. Thank guys.&lt;br /&gt;
&lt;br /&gt;
public class FactorGenerator&lt;br /&gt;
{&lt;br /&gt;
        public FactorGenerator(int aNum)&lt;br /&gt;
        {&lt;br /&gt;
            &lt;br /&gt;
            num = aNum;&lt;br /&gt;
            divBy = 1;&lt;br /&gt;
        }&lt;br /&gt;
       &lt;br /&gt;
        &lt;br /&gt;
        public int nextFactor()&lt;br /&gt;
        {&lt;br /&gt;
             while(divBy &amp;lt; num)&lt;br /&gt;
            {&lt;br /&gt;
                divBy++;&lt;br /&gt;
                factor = num % divBy;  &lt;br /&gt;
                 &lt;br /&gt;
            } &lt;br /&gt;
        return factor;    &lt;br /&gt;
        }&lt;br /&gt;
          public void hasNextFactor()&lt;br /&gt;
        {&lt;br /&gt;
            for (int i = 1; i &amp;lt; num; i++)&lt;br /&gt;
            {&lt;br /&gt;
                factor = num % divBy;&lt;br /&gt;
                &lt;br /&gt;
            }&lt;br /&gt;
           &lt;br /&gt;
        }&lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
       &lt;br /&gt;
        private int num;&lt;br /&gt;
        private int divBy;&lt;br /&gt;
        public int factor;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java/332534/332547/re-i-need-help--i-need-to-make-a-factorgenerator/#332547</guid>
      <pubDate>Mon, 20 Mar 2006 02:51:20 -0700</pubDate>
      <category>Java</category>
    </item>
    <item>
      <title>Re: I need help!!!  I need to make a FactorGenerator</title>
      <link>http://www.programmersheaven.com/mb/java/332534/332549/re-i-need-help--i-need-to-make-a-factorgenerator/#332549</link>
      <description>: : : Hi,&lt;br /&gt;
: : : I have a program to write for a chapter on loops and I have no clue where to start. I have to write a program that take in an int and prints the factors of the numbers.&lt;br /&gt;
: : : &lt;br /&gt;
: : : example:&lt;br /&gt;
: : : &lt;br /&gt;
: : : Please enter a number : 12&lt;br /&gt;
: : : 1&lt;br /&gt;
: : : 3&lt;br /&gt;
: : : 4&lt;br /&gt;
: : : 12&lt;br /&gt;
: : : &lt;br /&gt;
: : : If you guys can help i would really appreciate it. Thanks.&lt;br /&gt;
: : : &lt;br /&gt;
: : Use a for-loop to loop through the numbers until the loop reaches the number. You can check if a certain number is a factor of the entered int, by using the %-operator. The %-operator gives you the remainder of the division. Thus if a certain number is a factor of the entered int, then the remainder will be equal to 0.&lt;br /&gt;
: : &lt;br /&gt;
: this is what i got so far but it still doesn't work. i can't get the any number to print except for 0;&lt;br /&gt;
: my book says i have to use the nextFactor method and the hasNextFactor method and that it has to print this way&lt;br /&gt;
: example:&lt;br /&gt;
: 150&lt;br /&gt;
: 2&lt;br /&gt;
: 3&lt;br /&gt;
: 5&lt;br /&gt;
: 5&lt;br /&gt;
: if you could help me with this I would really appreciate it. Thank guys.&lt;br /&gt;
: &lt;br /&gt;
: public class FactorGenerator&lt;br /&gt;
: {&lt;br /&gt;
:         public FactorGenerator(int aNum)&lt;br /&gt;
:         {&lt;br /&gt;
:             &lt;br /&gt;
:             num = aNum;&lt;br /&gt;
:             divBy = 1;&lt;br /&gt;
:         }&lt;br /&gt;
:        &lt;br /&gt;
:         &lt;br /&gt;
:         public int nextFactor()&lt;br /&gt;
:         {&lt;br /&gt;
:              while(divBy &amp;lt; num)&lt;br /&gt;
:             {&lt;br /&gt;
:                 divBy++;&lt;br /&gt;
:                 factor = num % divBy;  &lt;br /&gt;
:                  &lt;br /&gt;
:             } &lt;br /&gt;
:         return factor;    &lt;br /&gt;
:         }&lt;br /&gt;
:           public void hasNextFactor()&lt;br /&gt;
:         {&lt;br /&gt;
:             for (int i = 1; i &amp;lt; num; i++)&lt;br /&gt;
:             {&lt;br /&gt;
:                 factor = num % divBy;&lt;br /&gt;
:                 &lt;br /&gt;
:             }&lt;br /&gt;
:            &lt;br /&gt;
:         }&lt;br /&gt;
:        &lt;br /&gt;
:        &lt;br /&gt;
:        &lt;br /&gt;
:         private int num;&lt;br /&gt;
:         private int divBy;&lt;br /&gt;
:         public int factor;&lt;br /&gt;
: }&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
You don't need the divBy. It is enough to divide by the i variable. That variable already holds the divisor.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java/332534/332549/re-i-need-help--i-need-to-make-a-factorgenerator/#332549</guid>
      <pubDate>Mon, 20 Mar 2006 02:53:26 -0700</pubDate>
      <category>Java</category>
    </item>
    <item>
      <title>Re: I need help!!!  I need to make a FactorGenerator</title>
      <link>http://www.programmersheaven.com/mb/java/332534/332601/re-i-need-help--i-need-to-make-a-factorgenerator/#332601</link>
      <description>hmmmmm. Your code is a little confused. Where is your main() method ? The following code produces the desired output and uses your method and variable names with some modification. When you have compiled it type : java FactorGenerator 12&lt;br /&gt;
to produce all the factors of 12. Replace 12 with any other number you wish to obtain the factors of that number.&lt;br /&gt;
&lt;br /&gt;
public class FactorGenerator&lt;br /&gt;
{ &lt;br /&gt;
	public FactorGenerator(int aNum) &lt;br /&gt;
	{ &lt;br /&gt;
 &lt;br /&gt;
	num = aNum; &lt;br /&gt;
	divBy = 1; &lt;br /&gt;
&lt;br /&gt;
	} &lt;br /&gt;
 &lt;br /&gt;
	public void nextFactor() &lt;br /&gt;
	{ &lt;br /&gt;
&lt;br /&gt;
		factor = num % divBy; &lt;br /&gt;
		divBy++;&lt;br /&gt;
&lt;br /&gt;
	} &lt;br /&gt;
&lt;br /&gt;
	public void hasNextFactor() &lt;br /&gt;
	{ &lt;br /&gt;
&lt;br /&gt;
		for (int i = 1; i &amp;lt;= num; i++) &lt;br /&gt;
		{ &lt;br /&gt;
&lt;br /&gt;
			nextFactor(); &lt;br /&gt;
			if (factor == 0 ) System.out.println( i );&lt;br /&gt;
&lt;br /&gt;
		} &lt;br /&gt;
 &lt;br /&gt;
	} &lt;br /&gt;
&lt;br /&gt;
	public static void main (String[] args)&lt;br /&gt;
	{&lt;br /&gt;
&lt;br /&gt;
		FactorGenerator fg = new FactorGenerator ( Integer.parseInt ( args[0] ));&lt;br /&gt;
		System.out.println ( fg.num );&lt;br /&gt;
		fg.hasNextFactor();&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
 &lt;br /&gt;
private int num; &lt;br /&gt;
private int divBy; &lt;br /&gt;
public int factor; &lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java/332534/332601/re-i-need-help--i-need-to-make-a-factorgenerator/#332601</guid>
      <pubDate>Mon, 20 Mar 2006 12:16:17 -0700</pubDate>
      <category>Java</category>
    </item>
    <item>
      <title>Re: I need help!!!  I need to make a FactorGenerator</title>
      <link>http://www.programmersheaven.com/mb/java/332534/332617/re-i-need-help--i-need-to-make-a-factorgenerator/#332617</link>
      <description>: hmmmmm. Your code is a little confused. Where is your main() method ? The following code produces the desired output and uses your method and variable names with some modification. When you have compiled it type : java FactorGenerator 12&lt;br /&gt;
: to produce all the factors of 12. Replace 12 with any other number you wish to obtain the factors of that number.&lt;br /&gt;
: &lt;br /&gt;
: public class FactorGenerator&lt;br /&gt;
: { &lt;br /&gt;
: 	public FactorGenerator(int aNum) &lt;br /&gt;
: 	{ &lt;br /&gt;
:  &lt;br /&gt;
: 	num = aNum; &lt;br /&gt;
: 	divBy = 1; &lt;br /&gt;
: &lt;br /&gt;
: 	} &lt;br /&gt;
:  &lt;br /&gt;
: 	public void nextFactor() &lt;br /&gt;
: 	{ &lt;br /&gt;
: &lt;br /&gt;
: 		factor = num % divBy; &lt;br /&gt;
: 		divBy++;&lt;br /&gt;
: &lt;br /&gt;
: 	} &lt;br /&gt;
: &lt;br /&gt;
: 	public void hasNextFactor() &lt;br /&gt;
: 	{ &lt;br /&gt;
: &lt;br /&gt;
: 		for (int i = 1; i &amp;lt;= num; i++) &lt;br /&gt;
: 		{ &lt;br /&gt;
: &lt;br /&gt;
: 			nextFactor(); &lt;br /&gt;
: 			if (factor == 0 ) System.out.println( i );&lt;br /&gt;
: &lt;br /&gt;
: 		} &lt;br /&gt;
:  &lt;br /&gt;
: 	} &lt;br /&gt;
: &lt;br /&gt;
: 	public static void main (String[] args)&lt;br /&gt;
: 	{&lt;br /&gt;
: &lt;br /&gt;
: 		FactorGenerator fg = new FactorGenerator ( Integer.parseInt ( args[0] ));&lt;br /&gt;
: 		System.out.println ( fg.num );&lt;br /&gt;
: 		fg.hasNextFactor();&lt;br /&gt;
: &lt;br /&gt;
: 	}&lt;br /&gt;
:  &lt;br /&gt;
: private int num; &lt;br /&gt;
: private int divBy; &lt;br /&gt;
: public int factor; &lt;br /&gt;
: } &lt;br /&gt;
: &lt;br /&gt;
: Thanks man your a life saver!&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java/332534/332617/re-i-need-help--i-need-to-make-a-factorgenerator/#332617</guid>
      <pubDate>Mon, 20 Mar 2006 15:19:39 -0700</pubDate>
      <category>Java</category>
    </item>
  </channel>
</rss>