I got "Operator '*' cannot be applied to 'java.lang.String', 'double'" on the 4th from bottom line. Any fixes? Thanks

Viewed 28

Below is code :

import java.util.Scanner;
public class Lab_04_01_SalesTax
{
    public static void main(String[] args) {

        Scanner myObj = new Scanner(System.in);
        System.out.println("What was the price of your purchase?");

        String price = myObj.nextLine();
        System.out.println("Price is: $" + price + " before tax.");

        int totalPrice = price * .05;
        System.out.println("Total price is: $" + totalPrice);

    }
}
0 Answers
Related