In: Computer Science
Write a program in java which calculates the total price of an item you purchased which includes sales tax. Create a Scanner object to read information from keyboard, Display prompts and get input, perform the calculation and display the Result of the program.
//Java program
import java.util.Scanner;
public class Price {
public static void main(String args[]) {
Scanner in = new
Scanner(System.in);
double
itemCost,taxRate,totalPrice;
System.out.print("Enter purchase
cost of item : $");
itemCost = in.nextDouble();
System.out.print("Enter sale tax
rate : ");
taxRate = in.nextDouble();
totalPrice =
itemCost*(1+taxRate/100);
System.out.printf("Total Price of
item : $%.2f",totalPrice);
in.close();
}
}
//sample output