Assignment 27: Variables Only Hold Values

Code

    /// Name: Ryan McAteer
    /// Period: 5
    /// Program Name: Variables Only Hold Values
    /// File Name: Assignment27.java
    /// Date Finished: 9/28/15

import java.util.Scanner;

class Assignment27 
{
      public static void main(String[] args) 
      {
           // BROKEN 
           
           Scanner keyboard = new Scanner(System.in);
           double price = 0, salesTax, total;
           
           System.out.print( "How much is the purchase price?" );
           price = keyboard.nextDouble();
          
           salesTax = price * 0.0825;
           total = price + salesTax;
           
           System.out.println( "Item price:\t" + price );
           System.out.println( "Sales tax:\t" + salesTax );
           System.out.println( "Total cost:\t" + total );
      }
}
           
    

Picture of the output

Assignment 27