Hi again all, I was just wondering how to insert the Pound Sterling Symbol "�" into a Java program running in the command prompt. I was also wondering if one of you could maybe check the code below and make sure it is ok and maybe give me some pointers to tidy it up if there are any. Thanks in advance guys, your all a really great help!
Thanks in advance! Regards, Emile
Nick George
Ranch Hand
Joined: Apr 04, 2004
Posts: 815
posted
0
As for command prompt, I think you're out of luck. Were you to write your application in a GUI, you could simply use unicode characters. If I remember correctly, pounds sterling is '\u00A3' (I looked that up). Charts abound on the web, this one's my favorite: Unicode Charts
I've heard it takes forever to grow a woman from the ground
Emile Ghazzawi
Greenhorn
Joined: Dec 30, 2002
Posts: 28
posted
0
Hi again, Any tips you could give on the posted code? Or does it all look ok to you? Regards, Emile
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
Overall it looks pretty good. A few things:- 1) when you start the program the first time - if you do nothing except select (6) quit, it errors when you open the program the next time. Test by renaming your current "stock.txt". this can be fixed by changing do { }while (input.ready()); to while (input.ready()) { } but don't know if this will break something else 2) suggest your program which look like this
to this
this way your code can be called by another program 3) when displaying the results of a query eg current stock level, after the code to display the results, add something like this System.out.println("Press [ENTER] to continue"); String junk = input.readLine(); this way the result will be at the bottom of the screen, where it is expected to be, instead of near the top, with the next option menu showing at the bottom ie you currently have to search the screen for the result. 4) if you want to have a bit of fun, try to convert it from arrays of data to a HashMap of objects - StockItem, with the stockCode being the key
I'm away for a couple of days, and if I get a chance I'll try to rewrite it the way I've suggested, which is probably an easier way to show you the difference.
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
Here's a bit of a re-write. It essentially does the same thing as your code. I've added a couple of menu items and changed the saving of the data to after each change. The main difference is removing the limit of stock items.