title: How to use asterisks to make a graph with existing data in a file?
body: <p>I have a two part assignment and I am having trouble with the second part.</p>
  
  <p>The first part of the assignment was to ask the user their weekly budget for 4 weeks and that information was to be saved to a file named budget.txt. If you need to see it I can copy and paste the code for you.</p>
  
  <p>Output looks like this:</p>
  
  <pre class="lang-none prettyprint-override"><code>Week 1 Budget: 230.99  
  Week 2 Budget: 800.00  
  Week 3 Budget: 125.00  
  Week 4 Budget: 1245.18
  </code></pre>
  
  <p>The second part of the assignment(the part I'm having trouble with) is to read the data the user input and make an asterisk graph from the information. Each asterisk is supposed to represent $100. The output of this second program I am working on should be like this(according to the information in the example above):</p>
  
  <pre class="lang-none prettyprint-override"><code>Week 1 Budget: **  
  Week 2 Budget: ********  
  Week 3 Budget: *  
  Week 4 Budget: ************  
  </code></pre>
  
  <p>How do I establish the connection that each asterisk represents $100 and have it output correctly? Here is my current code:  </p>
  
  <pre><code>public static void main(String[] args) throws FileNotFoundException
  {
      float budget;
  
      File file = new File("budget.txt");
      if (!file.exists())
      {
          System.out.println("The file budget.txt is not found.");
          System.exit(0);
      }
  
      Scanner inputFile = new Scanner(file);
  
      while (inputFile.hasNext())
      {
          //Read a value from the file.
          budget = inputFile.nextFloat();
  
          for(int c=0; c &lt;= 3; c++)
          {
              System.out.print("\nBudget for week " + (c +1) + ":");
  
              for(int k=0; k&lt;=budget/100; k++) 
              {
                  System.out.print("*");
              }
          }
          System.out.println();
  
          inputFile.close();
      }
  }
  </code></pre>