Results 1 to 20 of 27
Thread: How to I print a £ symbol?
- 08-01-2012, 01:33 PM #1
Senior Member
- Join Date
- Jul 2012
- Posts
- 165
- Rep Power
- 1
- 08-01-2012, 01:41 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Re: How to I print a £ symbol?
Where are you getting the 'u'?
Is it in the console?
In the IDE?
In a Swing component?Please do not ask for code as refusal often offends.
-
Re: How to I print a £ symbol?
Java Code:import java.text.*;
Java Code:NumberFormat formatter = NumberFormat.getCurrencyInstance(); System.out.println(formatter.format(number));
- 08-02-2012, 09:37 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Re: How to I print a £ symbol?
And where is it printing out to?
And is that place able to display a £ sign?Please do not ask for code as refusal often offends.
- 08-02-2012, 04:42 PM #5
Senior Member
- Join Date
- Jul 2012
- Posts
- 165
- Rep Power
- 1
Re: How to I print a £ symbol?
urm... I am very new to this so I didn't understand much of what any of you said.
This is my code:
Java Code:class Gambling { // Text on this side of the screen indicates lines where you must enter your own information public static void main(String[] args) { String UserName = "????????"; // Enter your name here (Within speech marks) int Age = ????????; // Enter your age here System.out.println("Hello " + UserName + ","); if (Age < 18) { System.out.println("You are too young to use this program, please quit it now."); return; } else { int wallet = ????????; // Enter your wallet value here (Full pounds only) int bet = ????????; // Enter your bet here (Full pounds only) if (wallet < bet) { System.out.println("You cannot bet more money than you have in your wallet!"); return; } else { System.out.println("You currently have £" + wallet + "in your wallet"); System.out.println("You have made a bet of" + bet); System.out.println("You have lost the bet!"); wallet = wallet - bet; System.out.println("You now have £" + wallet + "in your wallet"); } } } }
I type it in notepad, compile it with the CMD and then run it in the CMD
- 08-02-2012, 04:50 PM #6
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 1
Re: How to I print a £ symbol?
It looks like you want to use the Scanner class to accept input from the user.
Also, how does this program compile? ???????? is not a valid int value."Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill
- 08-02-2012, 04:51 PM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Re: How to I print a £ symbol?
I'm just trying to figure out where you're not seeing the £ sign.
Different applications can use different character sets, some of which might map characters differently.
So exactly where you are seeing the problem is quite important.
And that can include version numbers.Please do not ask for code as refusal often offends.
- 08-02-2012, 05:03 PM #8
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 1
Re: How to I print a £ symbol?
I believe this sequence will produce the sign that you are looking for: "\u20ac"
"Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill
- 08-02-2012, 06:26 PM #9
- 08-02-2012, 06:29 PM #10
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 1
Re: How to I print a £ symbol?
"Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill
- 08-02-2012, 07:58 PM #11
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
- 08-02-2012, 08:09 PM #12
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 1
- 08-02-2012, 08:25 PM #13
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
Re: How to I print a £ symbol?
When people rob a bank they get a penalty; when banks rob people they get a bonus.
- 08-02-2012, 08:35 PM #14
Senior Member
- Join Date
- Jul 2012
- Posts
- 165
- Rep Power
- 1
Re: How to I print a £ symbol?
I'm using it just as a placeholder so that I can easily see where I need to enter custom values at the moment, I change it before compiling.
I'm using the CMD in Windows 7 Home Premium with Service Pack 2 which is the CMD version 6.1.7601
I'll try it in a second, thanks
- 08-02-2012, 08:52 PM #15
Senior Member
- Join Date
- Jul 2012
- Posts
- 165
- Rep Power
- 1
- 08-02-2012, 09:09 PM #16
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
Re: How to I print a £ symbol?
Have a look at this little unicode table. That code point doesn't represent a pound sterling sign, not even in Unicode; your command prompt doesn't display unicode characters; first you have to figure out what encoding it uses so you can send that code point to it to display a pound sterling symbol.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 08-02-2012, 09:56 PM #17
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 1
Re: How to I print a £ symbol?
I certainly didn't mean to suggest invoking magic, religion, or even shots in the dark, and I apologize if I gave that impression. If he tried it and it worked, then he would know that his CMD can interpret Unicode (and he would have the solution to his problem.) If it didn't work (which is the case), then he would need to find another solution as you suggested.
Last edited by awinston; 08-02-2012 at 10:04 PM.
"Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill
- 08-02-2012, 10:21 PM #18
Re: How to I print a £ symbol?
Why do they call it rush hour when nothing moves? - Robin Williams
- 08-02-2012, 11:04 PM #19
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 1
Re: How to I print a £ symbol?
I managed to find a solution involving characters. All credit goes to someone of the username "arthurp" on this thread (it's the 6th post).
Java Code:char a = 339; System.out.println("You currently have " + a + wallet + " in your wallet!");"Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill
- 08-03-2012, 07:58 AM #20
Member
- Join Date
- Aug 2012
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Javax Print Attribute for Selection Print Range
By rsawatzky in forum AWT / SwingReplies: 0Last Post: 04-26-2012, 12:14 AM -
'@' Symbol
By AedonetLIRA in forum New To JavaReplies: 5Last Post: 12-09-2010, 01:05 AM -
cannot find symbol symbol :constructor Error. Please help! =(
By KalEl in forum New To JavaReplies: 9Last Post: 10-18-2008, 08:26 PM -
Print the text file and print preview them
By Java Tip in forum java.awtReplies: 0Last Post: 06-22-2008, 11:04 PM -
cannot find symbol symbol : class Item location: package platypos.services.order
By officialhopsof in forum New To JavaReplies: 3Last Post: 05-01-2008, 08:30 AM


LinkBack URL
About LinkBacks
Reply With Quote



Bookmarks