I am trying to get an inventory program can any one tell me what si wrong with this and how I can fix it, please!
import java.util.Scanner;
public class Cars1
{
// main method begins java application
public static void main( String args[] )
{
Scanner input = new Scanner( System.in );
System.out.println( "Please enter Product name:" );
String name = input.nextLine();
private String productName;
private String itemNumber;
private int numberOfUnits;
private double pricePerUnit;
System.out.print( "item number: " );
itemNumber = input.nextLine();
System.out.print( "number of units: " );
numberOfUnits = input.nextint();
System.out.print( "What is unit price: " );
System.out.printf( "price is $%f\n ",price );
} // end main
private String productName;
private String itemNumber;
private String numberOfUnits;
private double pricePerUnit;
public Cars( String product, String item, String number,
double price )
{
productName = product;
itemNumber = item;
numberOfUnits = number;
setPricePerUnit( price );
}
public void setProductName( String product )
{
productName = product;
}
public String getProductName()
{
return productName;
}
public void setItemNumber( String item )
{
itemNumber = itemNumber;
}
public String getItemNumber()
{
return itemNumber;
}
public void setNumberOfUnits( String number )
{
numberOfUnits = number;
}
public String getNumberOfUnits()
{
return numberOfUnits;
}
public void setPricePerUnit( double price )
{
price = ( price < 0.0 ) ? 0.0 : price;
}
public double getPrice()
{
return pricePerUnit;
}
public String toString()
{
return String.format( "%s: %s\n%s: %s\n%s: %s\n%s: %.2f",
"cars", productName,
"item number", itemNumber,
"number of units", numberOfUnits,
"price per unit", pricePerUnit );
}
} // end class Cars1