Start New Discussion within our Software Development Community

Hello, team. When I run my program it is not allowing me to run this program. Looking to the professionals for some help.

Tester

import java.util.Scanner;

public class ProductTester //the class ProductTester
{
    public static void main( String[] args, Object getPrice) //the main statement
    {
          Scanner user_input = new Scanner( System.in );

          Product product =  new Product("HP ENVY x360 TouchSmart");

          String formatString = "Product[name = %s, price = %.2f]\n";

          System.out.printf(formatString, product.getName(), product.getPrice());

          //user input the discount amount
          System.out.println("\nEnter discount percentage [0 - 100]: %.2f ");
          double discount = user_input.nextDouble();

          System.out.printf(formatString, product.getName(), product.applyDiscount(discount));
    }
}

Class

public class Product //the class named Product
{
    private String product; //the product name
    private double price = 0; //the product's value
    private double percent = 0.0;

    public Product (String name)
{
    product=name; //establishing the name as Apple iPod

}
    public String getName()
{
        return product; //returning the value of the String

}
    public void setPrice(double p)
{
    price = 200; //establishing the value as 200
}
    public double getPrice()
{
    return price; //returning the value of the price
}
    public double applyDiscount(double percent){
        return (100 - percent) * price / 100; 
    }

    public double getPercent()
    {
        return percent;
    }

    public void setPercent(double percent)
    {
        this.percent = percent;
    }



}

Any suggestions?

I figured out why it wasn't working. In my

public static void main( String[] args, Object getPrice)

Was incorrect, it should of been:

public static void main( String[] args)

Thank you anyway.

This question has already been answered. Start a new discussion instead.