Assignemnt #24
Code
/// Name: Sam Wilson
/// Period: 6
/// Program Name: variablecanonlyhold
/// File Name: variablecanonlyhold.java
/// Date Finished: 10/11/2015
import java.util.Scanner;
public class variablecanonlyhold
{
public static void main( String[] args )
{
// FIXED
Scanner keyboard = new Scanner(System.in);
double price, salesTax, total;
System.out.println();
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 );
System.out.println();
}
}
Picture of the output