4
Contributors
7
Replies
8
Views
8 Years
Discussion Span
Last Post by BestJewSinceJC
0

Wouldn't this do it for you?

int pound = price / 100;
int pennies = price % 100;
System.out.println("Price "+pound + "." + pennies);
//OR
System.out.println("Price "+ price/100 + "." + price%100);

Else you can play with formatting...

0

Ah thanks. I was just a bit confused about what to do. Makes sense now (originally i was using floats and it didnt work how i wanted)

0

Haha I just realized what was going on. At first I read this and I was thinking "how is ezzeral's code going to produce that pound symbol?" because I literally thought you wanted that sign before the amount

0

"\u00a3" is the British pound symbol in unicode, so that output actually is what he stated he wanted: £3.99p

Most likely his own locale settings would place the local currency symbol in many formats though without having to put in the unicode for that particular symbol.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.