title: 1D array frequency counter for other methods
body: <p>I wanted to call a method that would prompt the user to enter the miles driven, gallons used, calculate the miles per gallon, display how many miles per gallon this type of car got on this trip. I also wanted this method to passes back a “1” to add to the frequency counter for each type of car later on.  (If the car is a Honda, add a “1” to arrayname[1], if the car is a Toyota, add a “1” to arrayname[2], etc.). </p>
  
  <pre><code>     int[] mpgList = new int[5]; // 5 because there are 4 more car types
       mpgList[0] = 
  
      do{
          prompt = Double.parseDouble(JOptionPane.showInputDialog(null, "Enter"
              + "\n"
              + "1 For Honda"));
  
          if (prompt == 1)
          {     
              forHonda();
  
  
          };
  </code></pre>
  
  <p>......</p>
  
  <pre><code> public static void forHonda(){
      double miles, gallons, mpg;
  
      miles = Double.parseDouble(JOptionPane.showInputDialog(null,"Enter Miles Driven "));
          if (miles &lt;= -1){
              JOptionPane.showMessageDialog(null,"Input Is Negative"
                      + "\n"
                      + "Try Again");
          miles = Double.parseDouble(JOptionPane.showInputDialog(null,"Enter Miles Driven ")); 
          }
      gallons = Double.parseDouble(JOptionPane.showInputDialog(null,"Enter Gallons Used "));
          if (gallons &lt;= -1){
              JOptionPane.showMessageDialog(null,"Input Is Negative"
                      + "\n"
                      + "Try Again");
          gallons = Double.parseDouble(JOptionPane.showInputDialog(null,"Enter Gallons Used ")); 
          }
      mpg = (miles/gallons);
      if (gallons == 0){
          JOptionPane.showMessageDialog(null, "Division by Zero"
                  + "\n"
                  + "Try Again");
      miles = Double.parseDouble(JOptionPane.showInputDialog(null,"Enter Miles Driven "));
      gallons = Double.parseDouble(JOptionPane.showInputDialog(null,"Enter Gallons Used "));
      mpg = (miles/gallons);
      }
      JOptionPane.showMessageDialog(null,String.format("MPG for HONDA: %.0f"
              + "\n", mpg));
  </code></pre>
  
  <p>......</p>
  
  <pre><code>    public static void counter(int x[]){
      for(int counter = 0; counter&lt; x.length; counter++)
          x[counter]+=1;
  }
  </code></pre>
  
  <p>this was kind of the idea i was going for, but I got stuck at how to utilize the array for the freq counter </p>