I want the program to ask for and get the price of a book from a user. The program will then multiply the price by 7% sales tax and display both the sales tax and final price of the book (price + sales tax) on the screen. using Netbeans

WRITE A PROGRAM THAT WILL ASK FOR A PRICE. IF THE PRICE IS GREATER THAN 1000, COMPUTE A 10% DISCOUNT FROM THE ORIGINAL PRICE. DISPLAY THE COMPUTED DISCOUNT.

To create a program that asks for and calculates the sales tax for a book, you can follow these steps using NetBeans:

1. Open NetBeans and create a new Java project. Give it a suitable name.

2. Right-click on the project name in the "Projects" pane and select "New" and then "Java Class". Name the class, e.g., "BookSalesTaxCalculator" and click "Finish".

3. Inside the class, you will need the `Scanner` class to read input from the user and perform calculations. Add the following `import` statement at the top:

```java
import java.util.Scanner;
```

4. Define the main method where the program execution begins by adding the following code inside the class:

```java
public static void main(String[] args) {
// Create a Scanner object to read user input
Scanner scanner = new Scanner(System.in);

// Prompt the user to enter the price of the book
System.out.print("Enter the price of the book: ");
double price = scanner.nextDouble();

// Calculate the sales tax (7% of the price)
double salesTax = price * 0.07;

// Calculate the final price (price + sales tax)
double finalPrice = price + salesTax;

// Display the sales tax and final price on the screen
System.out.println("Sales Tax: $" + salesTax);
System.out.println("Final Price: $" + finalPrice);

// Close the Scanner object
scanner.close();
}
```

5. Save the file, and you can now run the program.

When the program runs, it will ask the user to enter the price of the book. After the user enters the price and presses Enter, the program will calculate the sales tax (7% of the price) and the final price (price + sales tax) and display them on the screen.