title: How to Round Decimals to 2 Places after the Decimal Point (Java)
body: <p>I am fairly new to java and I have to create this program to which I have no idea where to start. Can someone please help me with what to do and how to write the code to get started?</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>So far I have this:</p>
  
  <pre><code>package register;
  import java.util.Scanner;
  
  public class Register {
  
      public static void main(String[] args) {
  
          Scanner price = new Scanner(System.in);
  
          System.out.print("Please enter a price for item uno $");
          double priceuno = price.nextDouble();
  
          System.out.print("Please enter a price for item dos $" );
          double pricedos = price.nextDouble();
  
          System.out.print("Please enter a price for item tres $");
          double pricetres = price.nextDouble();
  
          double total = ((priceuno) + (pricedos) + (pricetres));
          System.out.println("The subtotal is $" + total);
  
          double tax = .06;
  
          double totalwotax = (total * tax );
          System.out.println("The tax for the subtotal is $" + totalwotax);
          double totalandtax = (total + totalwotax);
          System.out.println("The total for your bill with tax is $" + totalandtax);
  
      }
  }
  </code></pre>
  
  <p>The output (if the price is let's say price1 = 1.65, price2 = 2.82 and price3 = $9.08) looks like this:</p>
  
  <blockquote>
    <p>Please anter a price for item number one $1.65</p>
    
    <p>Please enter a price for item number two $2.82</p>
    
    <p>Please enter a price for item number three $9.08</p>
    
    <p>The subtotal is $13.55</p>
    
    <p>The tax for the subtotal is $0.8130000000000001</p>
    
    <p>The total for your bill with tax is $14.363000000000001</p>
  </blockquote>
  
  <p>What can I do to make the tax for the subtotal and the total bill be rounded off to two decimal places after the decimal point?</p>
  
  <p>Thanks</p>