strange semi-newbie issue
strange semi-newbie issue
- Subject: strange semi-newbie issue
- From: Andrew Kinnie <email@hidden>
- Date: Sun, 8 Feb 2004 16:49:12 -0500
OK, I am getting a strange issue with a method I'm writing. My app
tracks transactions, has a "Transaction" class, which includes an array
of objects of another class called "LineItem" which in turn has an
object of another class called "Item" and a quantity of type int. Item
has various information including "price" which is a double.
Now, I have a method in my LineItem class:
- (double)extendedPrice
{
NSLog(@"The price is: .10g", [item price]);
NSLog(@"The quantity is: %d", quantity);
NSLog(@"The extendedPrice is: .10g", [item price] * quantity);
return [item price] * quantity;
}
which is supposed to return the item's price * the LineItem's quantity.
Unfortuantely, I am getting output results like:
2004-02-08 16:41:35.806 POS[27434] The price is: 3.25
(this is correct)
2004-02-08 16:41:35.806 POS[27434] The quantity is: 8 (this is
correct)
2004-02-08 16:41:35.806 POS[27434] The extendedPrice is:
0 (this is NOT correct)
and the readout textfield says "2.728865371e+80" for the value.
I don't understand what is causing this, what fundamental thing I am
missing, or what I can do about it. the relevant accessor in the Item
class is:
- (double)price
{
return price;
}
If anyone can offer assistance, I'd appreciate it.
Andrew
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.