Variables Part 2 #27 (Organization is key, or else your program turns into a potato)

Code

    /// Name: Amir Salehi
    /// Period: 7
    /// Program name:  VariablesOnlyHoldValues
    /// File name:  VariablesOnlyHoldValues.java
    /// Date: Finished 10/5/2015 
import java.util.Scanner;
 
 public class VariablesOnlyHoldValues
 {
     public static void main( String[] args )
     {
 
         double price, salesTax, total;
         
         Scanner keyboard = new Scanner(System.in);
 
          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 7

Back to Homepage