
Patrick B. answered 10/13/20
Math and computer tutor/teacher
COMPILE ERRORS:
===============================
1) the constant must declared INSIDE the class as PUBLIC STATIC DOUBLE...
2) cost = Double.parsedouble(coststring); <-- capitalize parseDouble and costString
Runtime Logic errors:
Parenthesis required around the algebraic expression
so as to output the final amount
System.out.println("With " + TAX * 100 +
"% tax, purchase is $" + (cost + cost * TAX));
Here's a working copy:
//==================================
import java.util.*;
public class DebugTwo4
{
public static final double TAX = 0.06;
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
String costString;
double cost;
System.out.println("Enter price of item you are buying");
costString = input.next();
cost = Double.parseDouble(costString);
double tax = DebugTwo4.TAX;
System.out.println("With " + tax * 100 +
"% tax, purchase is $" + (cost + cost * tax));
}
}
Isiah K.
Thank you, much appreciated!10/13/20