Assignment #27 Variables Only Hold Values
Code
///Name: Ian Grant
///Period:5
///Project Name: Variables Only Hold Values
///File Name:Sequencing.java
///10/15/15
import java.util.Scanner;
public class Sequencing
{
public static void main(String[] args)
{
Scanner keyboard= new Scanner(System.in);
//You can't multiply a null variable, when the line is moved there is no error because it is not null.
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);
}
}
Output