package inventory;  // Product class
  import java.util.jar.Attributes.Name;
  // Creates Product Class, contains the inventory components
  public class Product
       public static main(String[] args)
         {//begin main method
            Number number = new Number(001); 
            Name name = new Name ("Highlighter");
            Units units = new Units (6);
            Price price = new Price (2.50);

           //print inventory information
            System.out.println("Inventory Program for Office  

            System.out.printf( "%s %d\n","Product Number", 
                          number );

            System.out.printf( "%s %s\n", "Product Name:", name );

            System.out.printf( "%s %d\n", "Total Units in Stock:",  
                     units );

            System.out.printf( "%s $%g\n", "Price Per Unit:", price);
            System.out.printf( "%s $%g\n", "Inventory Total:",   
                      units * price);
       }// end main method
 } // end class
public class Inventory //this is second class
 {//begin main method

   private int productNumber; // product number
   private String productName; // product name
   private int totalUnits; // total units in stock
   private double unitPrice; // price per unit
   public Inventory( int number, String name, int units, double price)
      { // initialize four-argument constructor
       productNumber = number;//validate and store product number
       productName = name; //validate and store product name
       totalUnits = units; // validate and store total products
       unitPrice = price; // validate and store price per product
      } // end four-argument constructor

      public int getProductNumber()
        return productNumber;

   public Inventory(String name)
       this.productName = null;

   public String getProductName()
        return productName;

      public int gettotalUnits()
        return totalUnits;

   public Inventory(double price)
      this.unitPrice = 0.00;

    public double getunitPrice()
        return unitPrice;

     } // end main method

There are no errors from line 25 to 62. This class compiles with no errors.

I am getting two errors, and I am at a loss. I would appreciate any help that someone can give me to point me in the correct direction.

Error #1 Line 10: java.lang.Number is abstract; cannot be instantiated.

Error #2 Line 12: cannot find symbol, symbol class units, location class inventory.Product (for both instances of "units").

Both errors are self explanatory. Read the error message. You can't instantiate (i.e. create an Object of) an abstract class type. Read the java tutorials about abstract classes for more information on why you can't do that. For the "Units" error message it simply can't locate any class definition for Units. So import it.

This article has been dead for over six months. Start a new discussion instead.