Assignemnt #27 Variables Only Hold Values
Code
/// Name: Jake Johnson
/// Period: 7
/// Program Name: Sequencing
/// File Name: Sequencing.java
/// Date Finished: 9/28/2015
import java.util.Scanner;
public class Sequencing
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
double price, salesTax, total; //not putting a value in for price works because to do math operations price needs to be defined.
System.out.print( "How much is the purchase price? " );
price = keyboard.nextDouble();
salesTax = price * 0.0825; //this must go after we get a value for price to do the math operations.
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