I have spent HOURS trying to get this blasted thing to work. I know that the problem is probably something super-simple... but I don't have anyone to teach me. My class is online, and is little or no help. I am here because I have nowhere else to turn.
No, I don't want pity. I want to learn how to do this so I can salvage my GPA and not have to repay for the class.
Anyway, the first part compiled:
CODE
// Inventory Program
public class Inventory // begin Inventory class
{
private int itemNumber; // number of the item
private String itemName; // name of the item
private int itemQuantity; // quanity of item in stock
private double itemPrice; // price of item
public Inventory( int itemNumber, String itemName, int itemQuantity, double itemPrice) // constructor
{
this.itemNumber = itemNumber;
this.itemName = itemName;
this.itemQuantity = itemQuantity;
this.itemPrice = itemPrice;
}
public void setItemNumber( int itemNumber )
{
this.itemNumber = itemNumber;
}
public int getItemNumber()
{
return this.itemNumber;
}
public void setItemName( String itemName )
{
this.itemName = itemName;
}
public String getItemName()
{
return this.itemName;
}
public void setItemQuantity( int itemQuantity )
{
this.itemQuantity = itemQuantity;
}
public int getItemQuantity()
{
return this.itemQuantity;
}
public void setItemPrice( double itemPrice )
{
itemPrice = itemPrice;
}
public double getItemPrice()
{
return this.itemPrice;
}
public double getInvValue()
{
return itemQuantity * itemPrice;
}
} // end Inventory class
The other... well, it didn't:
CODE
// begin Inventory display application
public class InventoryDisplay
{
// begin main method
public static void main( String args[] )
{
// display item number
System.out.printf( "Item number: \n%d\n",
getItemNumber() );
// display item name
System.out.printf( "Item name: \n%s\n",
getItemName() );
// display item quantity in stock
System.out.printf( "Item quantity: \n%d\n",
getItemQuantity() );
// display item price
System.out.printf( "Item price: $ %.2f\n",
getItemPrice );
// display inventory value
System.out.printf( "Inventory value: $ %.2f\n",
getInvValue );
} // end main
} // end InventoryDisplay
I get "cannot find symbol" on each
get statement. Yes, both are saved in the same directory, and I compiled the first and then the second. I am at a total loss for this.
I turned in the .java and .class files for Inventory, and the .java file for InventoryDisplay. Better something than nothing. I know it is screwed, but someone explain to me how and why, please.