Input the CP of a TV and rate of discount and calculate SP in Java programming

Please show the programming computer expert!!

Sure, here is a Java program that calculates the selling price (SP) of a TV given the cost price (CP) and the rate of discount:

```java
import java.util.Scanner;

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

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

// Prompt the user to enter the rate of discount
System.out.print("Enter the rate of discount (%): ");
double discountRate = scanner.nextDouble();

// Calculate the selling price
double sp = cp - cp * discountRate / 100;

// Display the selling price
System.out.println("The selling price is: " + sp);

// Close the scanner to free up resources
scanner.close();
}
}
```

This program uses the `Scanner` class to read input from the user. It first prompts the user to enter the cost price (`cp`) of the TV, then prompts the user to enter the rate of discount (`discountRate`) as a percentage. The program then calculates the selling price (`sp`) by subtracting the discount amount from the cost price, and finally displays the selling price.

To calculate the selling price (SP) of a TV given its cost price (CP) and rate of discount, you can use the following Java code:

```java
import java.util.Scanner;

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

// Prompt the user to enter the cost price (CP) and rate of discount
System.out.print("Enter the cost price (CP): ");
double cp = scanner.nextDouble();

System.out.print("Enter the rate of discount (in percentage): ");
double discountRate = scanner.nextDouble();

// Calculate the selling price (SP) using the formula:
// SP = CP - (CP * discountRate / 100)
double sp = cp - (cp * discountRate / 100);

// Display the selling price (SP)
System.out.println("The selling price (SP) is: " + sp);
}
}
```

Here's how the code works:

1. First, we import the `Scanner` class from the `java.util` package. This class is used to read input from the user.
2. We define a class called `TVPriceCalculator` that contains the `main` method, which is the entry point of our program.
3. Inside the `main` method, we create a `Scanner` object named `scanner` to read input from the user.
4. We prompt the user to enter the cost price (CP) and rate of discount.
5. The user's input for CP is stored in the variable `cp`, and the input for the discount rate is stored in the variable `discountRate`.
6. We calculate the selling price (SP) using the formula: SP = CP - (CP * discountRate / 100).
7. Finally, we display the selling price (SP) to the user.

To run this code, you can copy and paste it into a Java IDE (Integrated Development Environment) such as Eclipse or IntelliJ IDEA, and then run the program. The program will ask you to enter the CP and rate of discount, and it will calculate and display the selling price (SP).