Assignment #27

Code

  /// Name: Jonathan Stine
 /// Period: 5
 /// Program Name: Sequencing
 /// File Name: Sequencing.java
 /// Date Finished: 10/14/2015
    
    import java.util.Scanner;
    
    public class Sequencing 
    {
        
        public static void main( String[] args ) 
        {
            
            Scanner keyboard = new Scanner(System.in);
            double price, salesTax, total;
           
            System.out.println( "How much is the purchase price? " );
            price = keyboard.nextDouble();
            
            salesTax = price*0.0925;
            total = price + salesTax;
            
            System.out.println( "Item price:\t" + price );
            System.out.println( "Sales tax:\t" + salesTax );
            System.out.println( "Total cost:\t" + total );
        }
    }


            // without the "=0" the variable price has no value, so salesTax can't be found.
            // once salesTax and total are defined, there is no error when "=0" is deleted.
    

Code Output