Question
My output should be Enter price of item you are buying 12 (my input) With 6.0% tax, purchase is $12.00.72 (the purchase price should be
My output should be Enter price of item you are buying
12 (my input)
With 6.0% tax, purchase is $12.00.72 (the purchase price should be $12.72)
What am I doing wrong? My code is below.
import java.util.Scanner; public class DebugTwo4 { public static void main(String[] args) { Scanner input = new Scanner(System.in); String costString; double cost; double TAX = .06; System.out.println("Enter price of item you are buying"); costString = input.next(); cost = Double.parseDouble(costString); System.out.println("With " + TAX *100 + "% tax, purchase is $" + cost + cost * TAX); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started