Product Discount

Program to create non return type method name input() to enter product price and discount rate. Now define a method calculate() to calculate the discount and the price after applying the discount. Print all the details and price in a method display(). Call all the three methods inside the main() method.

Java
import java.util.*;
public class ProductDiscount
{
    double price,discountRate,discount,amountAfterDiscount;
    public void input() 
    {
        Scanner sc=new Scanner(System.in);
        System.out.print("Enter product price: ");
        price=sc.nextDouble();
        System.out.print("Enter discount rate: ");
        discountRate=sc.nextDouble();
        System.out.println();
    }
    public void calculate() 
    {
        discount=price*(discountRate/100);
        amountAfterDiscount=price-discount;
    }
    public void display() 
    {
        System.out.println("Product Price: "+price);
        System.out.println("Discount Value: "+discount);
        System.out.println("Actual Price: "+amountAfterDiscount);
    }
    public static void main(String[] args) 
    {
        ProductDiscount ob=new ProductDiscount();
        ob.input();
        ob.calculate();
        ob.display();
    }
}
Java