Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

need help with class info and cannot find symbol error.

807606Feb 18 2007 — edited Feb 18 2007
I having problems with a cannot find symbol error. I cant seem to figure it out.
I have about 12 of them in a program I am trying to do. I was wondering if anyone could help me out?

Here is some code I am working on:


// This will test the invoice class application.
// This program involves a hardware store's invoice.

//import java.util.*;

public class InvoiceTest
{
public static void main( String args[] )
{
Invoice invoice1 = new Invoice( "1234", "Hammer", 2, 14.95 );

// display invoice1
System.out.println("Original invoice information" );
System.out.println("Part number: ", invoice1.getPartNumber() );
System.out.println("Description: ", invoice1.getPartDescription() );
System.out.println("Quantity: ", invoice1.getQuantity() );
System.out.println("Price: ", invoice1.getPricePerItem() );
System.out.println("Invoice amount: ", invoice1.getInvoiceAmount() );

// change invoice1's data
invoice1.setPartNumber( "001234" );
invoice1.setPartDescription( "Yellow Hammer" );
invoice1.setQuantity( 3 );
invoice1.setPricePerItem( 19.49 );

// display invoice1 with new data
System.out.println("Updated invoice information" );
System.out.println("Part number: ", invoice1.getPartNumber() );
System.out.println("Description: ", invoice1.getPartDescription() );
System.out.println("Quantity: ", invoice1.getQuantity() );
System.out.println("Price: ", invoice1.getPricePerItem() );
System.out.println("Invoice amount: ", invoice1.getInvoiceAmount() );

}

}


and that uses this class file:


public class Invoice

{
private String partNumber;
private String partDescription;
private int quantityPurchased;
private double pricePerItem;

public Invoice( String ID, String desc, int purchased, double price )
{
partNumber = ID;
partDescription = desc;
if ( purchased >= 0 )
quantityPurchased = purchased;
if ( price > 0 )
pricePerItem = price;
}

public double getInvoiceAmount()
{
return quantityPurchased * pricePerItem;
}

public void setPartNumber( String newNumber )
{
partNumber = newNumber;
System.out.println(partDescription+" has changed to part "+newNumber);
}

public String getPartNumber()
{
return partNumber;
}

public void setDescription( String newDescription )
{
System.out.printf("%s now refers to %s, not %s.\n",
partNumber, newDescription, partDescription);
partDescription = newDescription;
}

public String getDescription()
{
return partDescription;
}

public void setPricePerItem( double newPrice )
{
if ( newPrice > 0 )
pricePerItem = newPrice;
}

public double getPricePerItem()
{
return pricePerItem;
}
}


Any tips for helping me out?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 18 2007
Added on Feb 18 2007
15 comments
1,314 views