title: How to use For Loop in Java to ask user for Input
body: <p>Here is my assignment:</p>
  
  <p><strong>Write a program that will emulate a cash register. Prompt the user to input the price of three items. Add them together to get a subtotal. Determine the tax (6% ) on the subtotal. Find the total amount of the sale subtotal plus tax. Display the price of each item, subtotal amount, tax amount and final amount.</strong></p>
  
  <p>I have it done like this:</p>
  
  <pre><code>package cashregisteremulator;
  
  import java.util.Scanner;
  
  public class CashRegisterEmulator {
  
    public static void main(String[] args) {
  
      Scanner price = new Scanner(System.in);
  
  
      System.out.print("Please enter a price for item number one $");
      double price1 = price.nextDouble();
  
      System.out.print("Please enter a price for item number two $" );
      double price2 = price.nextDouble();
  
      System.out.print("Please enter a price for item number three $");
      double price3 = price.nextDouble();
  
      double total = ((price1) + (price2) + (price3));
      System.out.println("The subtotal is $" + total);
  
      double tax = .06;
  
      double totalnotax = (total * tax );
      System.out.println("The tax for the subtotal is $" + totalnotax);
      double totalplustax = (total + totalnotax);
      System.out.println("The total for your bill with tax is $" + totalplustax);
  
    }
  }
  </code></pre>
  
  <p>However, I need to do this assignment using a loop. Since the prompt asks for only 3 iterations, I thought of using a for loop. So far I have this:</p>
  
  <pre><code>package CashRegister;
  
  import java.util.Scanner;
  
   public class CashRegister {
  
  public static void main(String[] args) {
      Scanner askPrice = new Scanner(System.in);  
  
     for(double i = 0 ; i &lt; 3; i++);  
   {
     System.out.println("Enter a value") ;
     double price = askPrice.nextDouble();
  
  
  
   }
  }    
  }
  </code></pre>
  
  <p>What do I have to do in order to ask the user for a price three times?</p>