knlu
Jul 27th, 2000, 02:41 PM
Hi,
I'm working on a class architecture for a shopping system. I'm working with Java JDK 1.1.8 of a windows console. And I'm having a problem with linking my two classes together. Any help would be great.
PS. I know this is a easy prob. Sorry I'm a newbie to java
The error I recieve is :
C:\jdk1.1.8\bin>javac Book.java
Book.java:3: Superclass Orderable.Orderable of class Orderable.Book not found.
public class Book extends Orderable
^
1 error
----------------------------------------------------------
The two classes I'm working with are
Orderable.java -------
package Orderable;
public abstract class Orderable
{
public int itemNumber, itemQuantity;
public String itemName;
public double itemPrice;
public Orderable(int anItemNumber, String anItemName, double anItemPrice, int anItemQuantity)
{
this.itemNumber = anItemNumber;
this.itemName = anItemName;
this.itemPrice = anItemPrice;
this.itemQuantity = anItemQuantity;
}
public Orderable()
{
this.itemNumber = 0;
this.itemName = null;
this.itemPrice = 0;
this.itemQuantity = 1;
}
public int getItemNumber() { return itemNumber; }
public void setItemNumber ( int anItemNumber )
{
this.itemNumber = anItemNumber;
}
public String getItemName() { return itemName; }
public void setItemName ( String anItemName )
{
this.itemName = anItemName;
}
public double getItemPrice() { return itemPrice; }
public void setItemPrice( double anItemPrice )
{
this.itemPrice = anItemPrice;
}
public int itemQuantity() { return itemQuantity; }
public void setItemQuantity ( int anItemQuantity )
{
this.itemQuantity = anItemQuantity;
}
public boolean isLessThan(Orderable anOrderable)
{
return true;
}
public abstract void print();
}
Book.java -----------
package Orderable;
public class Book extends Orderable
{
protected String author;
protected int edition;
public Book(int anItemNumber, String anItemName, double anItemPrice, int anItemQuantity, String anAuthor, int anEdition)
{
super(anItemNumber, anItemName, anItemPrice, anItemQuantity);
this.author = anAuthor;
this.edition = anEdition;
}
public Book()
{
super();
this.author = null;
this.edition = 0;
}
public String getAuthor() {return author;}
public void setAuthor (String anAuther)
{
this.author = anAuthor;
}
public int getEdition() {return edition;}
public void setEdition (String anEdition)
{
this.edition = anEdition;
}
public void print()
{
System.out.println("Item Number: "+super.itemNumber);
System.out.println("Item Name: "+super.itemName);
System.out.println("Item Price: "+super.itemPrice);
System.out.println("Item Quantity: "+super.itemQuantity);
System.out.println("Author: "+author);
System.out.println("Edition: "+edition);
}
}
[Edited by knlu on 07-31-2000 at 01:20 PM]
I'm working on a class architecture for a shopping system. I'm working with Java JDK 1.1.8 of a windows console. And I'm having a problem with linking my two classes together. Any help would be great.
PS. I know this is a easy prob. Sorry I'm a newbie to java
The error I recieve is :
C:\jdk1.1.8\bin>javac Book.java
Book.java:3: Superclass Orderable.Orderable of class Orderable.Book not found.
public class Book extends Orderable
^
1 error
----------------------------------------------------------
The two classes I'm working with are
Orderable.java -------
package Orderable;
public abstract class Orderable
{
public int itemNumber, itemQuantity;
public String itemName;
public double itemPrice;
public Orderable(int anItemNumber, String anItemName, double anItemPrice, int anItemQuantity)
{
this.itemNumber = anItemNumber;
this.itemName = anItemName;
this.itemPrice = anItemPrice;
this.itemQuantity = anItemQuantity;
}
public Orderable()
{
this.itemNumber = 0;
this.itemName = null;
this.itemPrice = 0;
this.itemQuantity = 1;
}
public int getItemNumber() { return itemNumber; }
public void setItemNumber ( int anItemNumber )
{
this.itemNumber = anItemNumber;
}
public String getItemName() { return itemName; }
public void setItemName ( String anItemName )
{
this.itemName = anItemName;
}
public double getItemPrice() { return itemPrice; }
public void setItemPrice( double anItemPrice )
{
this.itemPrice = anItemPrice;
}
public int itemQuantity() { return itemQuantity; }
public void setItemQuantity ( int anItemQuantity )
{
this.itemQuantity = anItemQuantity;
}
public boolean isLessThan(Orderable anOrderable)
{
return true;
}
public abstract void print();
}
Book.java -----------
package Orderable;
public class Book extends Orderable
{
protected String author;
protected int edition;
public Book(int anItemNumber, String anItemName, double anItemPrice, int anItemQuantity, String anAuthor, int anEdition)
{
super(anItemNumber, anItemName, anItemPrice, anItemQuantity);
this.author = anAuthor;
this.edition = anEdition;
}
public Book()
{
super();
this.author = null;
this.edition = 0;
}
public String getAuthor() {return author;}
public void setAuthor (String anAuther)
{
this.author = anAuthor;
}
public int getEdition() {return edition;}
public void setEdition (String anEdition)
{
this.edition = anEdition;
}
public void print()
{
System.out.println("Item Number: "+super.itemNumber);
System.out.println("Item Name: "+super.itemName);
System.out.println("Item Price: "+super.itemPrice);
System.out.println("Item Quantity: "+super.itemQuantity);
System.out.println("Author: "+author);
System.out.println("Edition: "+edition);
}
}
[Edited by knlu on 07-31-2000 at 01:20 PM]