I am on the second step of my Inventory Project and can properly run my Inventory2.java file but not my Product2.java file. I get the following error: 71:cannot find symbol, symbol: method getItemTitle() location: class Product
returntitle.com pareTo(p.getIte mTitle());
^
Here is my code:
Any suggestions? Thanks! ITQUEST
returntitle.com pareTo(p.getIte mTitle());
^
Here is my code:
Code:
// Product2 class
import java.util.*;
class Product2 implements Comparable {
private String title; // class variable stores the item title
private long number; // class variable stores the item number
private long stockQuantity; // class variable stores the quantity in stock
private double price; // class variable stores the item price
public Product2() {
title = "";
number = 0L;
stockQuantity = 0L;
price = 0.0;
}
public Product2(String title, long number, long stockQuantity, double price) {
this.title = title;
this.number = number;
this.stockQuantity = stockQuantity;
this.price = price;
}
public void setItemTitle(String title) {
this.title = title;
}
public String getItemTitle() {
return title;
}
public void setItemNumber(long number) {
this.number = number;
}
public long getItemNumber() {
return number;
}
public void setStockQuantity(long quantity) {
stockQuantity = quantity;
}
public long getStockQuantity() {
return stockQuantity;
}
public void setItemPrice(double price) {
this.price = price;
}
public double getItemPrice() {
return price;
}
public double calculateInventoryValue() {
return price * stockQuantity;
}
public int compareTo (Object o) {
Product p = null;
try {
p = (Product)o;
}
catch(ClassCastException cE) {
cE.printStackTrace();
}
return title.compareTo(p.getItemTitle());
}
public String toString() {
return "DVD Title: "+title + "\nNumber: "+number+"\nPrice: $"+price+"\nQuantity: "+stockQuantity + "\nValue: $"+calculateInventoryValue();
}
} // end class Product2
Any suggestions? Thanks! ITQUEST
Comment