Beginner - can't get through, mind looking at code and errors?
So based on the huge help you guys were this morning, im going to post up again, here is what i have thus far (2 files)
Code:
// Ex3.13 Invoice.java (JHtP page104)
//invoice a hardware store might use to represent an invoice
//for an item sold at the store
public class Invoice
{
private String partNumber; // part number for invoice
private String partDescription; //part description for invoice
private int quantity; //number of parts being purchased
private double pricePerItem; // price per item
// 4-arg constructor
public Invoice (String partNumber, String partDescription,
int count, double price)
{
setpartNumber ( partNumber );
setpartDescription ( partDescription );
if (count > 0) //determine whether count is positive
quanity = count; // valid count assigned to quantity
if (price > 0.0) // determine whether price is positive
pricePerItem = price; // valid price assign to pricePerItem
setquantity ( quantity );
setpricePerItem ( price );
} // end 4-arg constructor
// set Part number:
public void setpartNumber ( String partNumber)
{
partNumber = partNumber; //accept the passed part value-assgn to instance v partNumber
}// end method setpartNumber
// get Part number:
public String partNumber ()
{
return partNumber;
} //end method getpartNumber
// set partDescription:
public void setpartDescription ( String partDescription )
{
partDescription = partDescription; // accept the passed part value-assgn to instance v partDesc
}// end method setpartDescription
//get partDescription:
public String partDescription ()
{
return partDescription;
}// end method getpartDescription
// set quantity:
public void setquantity ( int count)
{
quantity = count;
}// end method set quantity
// get quantity:
public int count ()
{
return quantity;
} //end method get quantity
// set pricePerItem
public void setpricePerItem ( double price )
{
pricePerItem = price;
}// end method set pricePerItem
//get pricePerItem
public double price ()
{
return pricePerItem;
} // end method get pricePerItem
// method to getInvoiceAmount (multiplies quantity * price per item)
public double invoiceAmount ()
{
return quantity * pricePerItem;
}// end method getInvoiceAmount
} // end public class Invoice
and this
Code:
// Ex3.13 InvoiceTest.java (JHtP page104)
//
public class InvoiceTest
{
public static void main ( String args [] )
{
//create instance of Invoice passing 4 argument values
Invoice invoice1 = new Invoice ( "1234", "Hammer", "2", "14.99");
//display invoice1
System.out.println ("Original invoice information");
System.out.printf ( "Part Number: %s\n", invoice1.getpartNumber () );
}
}//end public class InvoiceTest
3 errors
Invoice.java:20: cannot find symbol
symbol : variable quanity
location: class Invoice
quanity = count; // valid count assigned to quantity
^
InvoiceTest.java:9: cannot find symbol
symbol : constructor Invoice(java.lang.String,java.lang.String,java.lan g.String
,java.lang.String)
location: class Invoice
Invoice invoice1 = new Invoice ( "1234", "Hammer", "2", "14.99")
;
^
InvoiceTest.java:13: cannot find symbol
symbol : method getpartNumber()
location: class Invoice
System.out.printf ( "Part Number: %s\n", invoice1.getpartNumber
() );
^
3 errors
I have to still do more on the InvoiceTest file with regards to String.out.print to show the info, but i wanted to compile and see the errors i have up until now to see what needs to be fixed. there were like 10 errors, i seem to have it down to 3 (hopefully)
Any help/hints are appreciated. Thanks.