View Single Post
Old 12-16-2012, 06:47 PM   PM User | #1
abell12
New Coder

 
Join Date: Mar 2012
Posts: 31
Thanks: 1
Thanked 1 Time in 1 Post
abell12 is an unknown quantity at this point
Converting pence into pounds help

I want to convert a pence value to pounds.
So I have something like this:

Code:
    
public double toPounds()
{
int itemPrice = 256;    
int pounds = itemPrice / 100;
int pence = itemPrice % 100;
return pounds + pence;
}
The int pounds works returning the value 2.0 for the 2 pounds.
But its the pence im stuck on.
Can anyone help me out.

Thanks in advance.
abell12 is offline   Reply With Quote