title: FizzBuzz using Methods in Java
body: <p>I have solved this all inside the main method, however the professor has asked we follow very specific guidelines. Here are the instructions:</p>
  
  <blockquote>
    <ol>
    <li><p>Create methods with the following signatures (don’t forget <code>static</code>):</p>
    
    <ul>
    <li><code>private static boolean isFizz (int val)</code> check if a multiple of 3.</li>
    <li><code>private static boolean isBuzz(int val)</code> check if a multiple of 5.</li>
    </ul></li>
    <li><p>Create a class member variable (this means it’s not inside a method, but is inside a class):</p>
    
    <ul>
    <li><code>private static int counter</code></li>
    <li>Note: you can initialize this when you declare it, or inside the main method.</li>
    </ul></li>
    <li>In the main method:
    
    <ol>
    <li>Use the counter to iterate from 1 to 100.</li>
    <li>Use the two other methods you define to determine what to print.
    
    <ul>
    <li>Note that the methods should not print anything, they just return a boolean value.</li>
    </ul></li>
    <li>Your program should include at least one of each of the following:
    
    <ul>
    <li>branch control statement (like <code>if</code>).</li>
    <li>loop.</li>
    </ul></li>
    </ol></li>
    </ol>
  </blockquote>
  
  <pre><code>public class Fizzy {
  
      //checking if a multiple of 3
      private static boolean isFizz(int i){
          if (i % 3 == 0){
              return true;
          }
          return false;
      }
      //checking if a multiple of 5
      private static boolean isFuzz(int i){
          if (i % 5 == 0){
              return true;
          }
          return false;
      }
  
      //professor wants a class here outside of main with a private static int.
      //But I get an error and I'm not sure what I need to do to fix it.
      //also, is this where my booleans need to be called?
  
      public class Counter {
  
         private static int counter(int x);
  
      }
  
  
      public static void main (String [] args){
  
          //I think I'm supposed to call something here?
          //I've tried Counter a = new Counter(); but it doesn't like it.
          //I've tried new booleans but also doesn't like it.
  
          /**
           * for loop to iterate i to 100
           */
  
          //counter is supposed to be iterated here. However I am not sure
          //how to exactly access counter from a separate class.
  
          for(counter; counter &lt;= 100; ++counter){
  
               //if Statement to check if a multiple of 3 and 5.
              if (counter % 3 == 0 &amp;&amp; counter % 5 == 0){
                  System.out.println("FizzBuzz");
              }
              // else if statement to check if multiple of 3
              else if (isFizz == true){
                  System.out.println("Fizz");
              }
              //else if statement to check if multiple of 5
              else if (isFuzz == true){
                  System.out.println("Buzz");
              }
               //else just run the loop
              else {
                  System.out.println(counter);
              }
  
          }
      }
  
      }
  }
  </code></pre>
  
  <p>It is supposed to go like this:</p>
  
  <pre><code>1
  2
  Fizz
  4
  Buzz
  Fizz
  .
  .
  .
  14
  FizzBuzz
  16
  </code></pre>
  
  <p>And so on.</p>