How do you get .00 to show?

I am new to java programming. We have a project we are working on that uses decimals. Say you want to enter $12.00, when you click the calculate button it shows $12.0. How do you get the second 0 to show? Any help appreciated. The variables are a double and labels are .setText using a Math.round.
Sharon

When one runs this program in MSDOS, it will not render the '�' sign to see this change the '$' sign and type;-
DOSPrompt>java Money >money.txt
Then one can see some real money signs - jolly nice.
/* One can test this whole program by writing in a double value at the prompt.
** It will convert the vlue to a money value such as "$15.99" or "$16.00"
** Note: the MSDOS shell does not render '�' signs given in the unicode '\u00A3'
** I have written to Bill Gates about this issue on numerous occasions and yet
** he seems unable to respond to my strongly worded letters.
** Author: Lady Margaret Thatcher (now a Baroness). */
import java.text.*;
public class Money {
public static void main (String []args) {
   double d= 0.0D;
   // Catch all exception and exit
   try {
      d = Double.parseDouble(args[0]);
   catch(Exception e){
      System.out.println("\nEnter any large floating point number");
      System.exit(0); 
   DecimalFormat decfmt = new DecimalFormat();
   decfmt.setMaximumFractionDigits(2);
   String money = '$' + decfmt.format(d); // one can change this '\u00A3' or '�' for the � sign
   if (money.length() < 4) money += ".00";
   System.out.println("Money value: "+money);
}

Similar Messages

  • How do you get ical to show on your home screen?

    How do you get ical to show on your home screen? I deleted it from my homescreen (somehow) and i want to get it back.

    Just open the International preferences panel, go to Times, Customize, and click on the leftmost number (hours). A small triangle lights up, and a pop-up list of various formats opens. Just select the one you like (1-24 or 01-24). Make sure to set the Date & Time preferences to 24-hour clock first.

  • How do you get it to show the temperature when you scroll down?

    On some some IDevices I see when you scroll down, it shows the temperature and the date. But on my iPad mini when I scroll down, it just shows the day. But at the bottom it says, " weather information provided by yahoo" I have yahoo weather installed. How do I get it to show the temperature too? Thanks.

    Settings->Privacy->Location Services->Weather-> Turn it on.
    It will show your current locations weather. Note that it uses GPS and internet access. so it may use your Cellular Data and battery.

  • How do you get users to show up in finder?

    How do you get the users to be listed in the right pane?
    Thanks

    Hi Rolomoto, when in Finder, press shift+command+G and type "/Users" in the box (without the quotes). You can also get the "Go To" box from the Finder menu. Finder will show you the different users folders, with the currently logged in user having a "house" for the folder. Because each users' folder is for them only, you won't get permission to see much inside them.

  • How do you get your tv shows and all your movies to download on your ipod 5

    How do I get all my movies and tv shows to pop up on my ipod. I have downloaded them but they wont show up and i have no clue what to do. HELP!

    Download fromn where?
    Have you tried using the Search feature? Maybe you can't find them

  • On an iPod 5 how do you get it to show your battery percentage

    I saw on my friends iPhone 5 that it showed the percentage
    of battery at the top.. How do you do that in settings
    on an iPod 5?

    There is a way that iPod touches can get battery percentage. Note that this will work for any iPod on any iOS. You do NOT need to jailbreak for this to work.
    You will need to download iBackupbot for itunes it is for Mac and Windows.
    1. Download iBackupBot for Windows or Mac.
    2. Plug in your iPod Touch, Launch iTunes and create a current Backup of your iPod.
    3. Open iBackupBot, and click your latest backup located on the left side. Then close iTunes.
    4. Find: Library/Preferences/com.apple.springboard.plist in the right window and double click to open it,
    hit cancel to bypass the registration notice.
    5. On the next line down after <dict> type this exactly as shown:
    <key>SBShowBatteryLevel</key>
    <true/>
    Restore your iPod through iTunes using the backup you just edited.
    Thats how you get it!

  • How do you get it to show a picture of the albumn your on

    As you can see on the main advertisement for the 20gb color ipod, there is a picture of the albumn of the song your listening to, how do you assign pictures to certain bands or albumns?

    iPhoto??
    Jack,
    Here are a couple of methods.Go to <a href="http://images.google.com/Ó>Google Image Search</a> and type in (say) "The Beatles", and click on search images. That brings up 327,000 images!! You could be more specific and just type in "Abbey Road", if that was what you were looking for. Double click on a picture you like, then at the top of that page click on "see full size image". When you get that image, simply copy/paste it into the space for album artwork in iTunes. Make sure you select the album in the browser of iTunes before you copy/paste. You'd be surprised what Google Images can bring up. There are literally millions, and even obscure album artwork can be found.
    In the unlikely event that Google canÕt find an image, you can also get artwork from Amazon.
    If youÕre happy using images from Amazon, and donÕt want to copy/paste, then http://www.yvg.com/itunesartimporter.shtml&#211;>Art Importer is a nice free program to do it for you.

  • HT202213 how do you get it to show up in the sidebar again, after setting it up?

    how do i get home sharing to tapear agian in the toolbar, after i set it up?

    I can sort of reproduce what your talking about I think its because your setting the Start and Due date to the same time which seems to affect the search folder that's used for the view. The following seems to work okay for me
    Task taskItem = new Task(service);
    taskItem.Subject = "Created From qqq";
    taskItem.Body = "body";
    taskItem.IsReminderSet = true;
    taskItem.ReminderDueBy = DateTime.Now;
    taskItem.StartDate = DateTime.Now;
    taskItem.DueDate = DateTime.Now.AddHours(1);
    taskItem.Status = TaskStatus.NotStarted;
    ExtendedPropertyDefinition PidLidToDoOrdinalDate = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Common, 0x85A0, MapiPropertyType.SystemTime);
    taskItem.SetExtendedProperty(PidLidToDoOrdinalDate, DateTime.Now.AddHours(1));
    ExtendedPropertyDefinition FlagDueBy = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Common, 0x8560, MapiPropertyType.SystemTime);
    taskItem.SetExtendedProperty(FlagDueBy, DateTime.Now.AddHours(1));
    taskItem.Save();
    Cheers
    Glen

  • How do you get Emoji to show on other mobile phones?

    Why doesnt it show up on other phones when you text?

    Assuming that you have downloaded the app already. Settings - general - keyboard - international keyboard - then add the emoji keyboard.  then when you are in your text message hit the globe icon to the left of the space bar and your emoji will show up.

  • How do you get spaces to show everything in that space so you can drag...

    Stuff into other spaces?

    Invoke spaces, then invoke Exposé (or the other way around; either works).
    You can also drag to the dock icon and hit the spacebar to open show the app.
    You can also enable a 'hidden' dock preference to always spring open dock items:
    Defaults write com.apple.dock enable-spring-load-actions-on-all-items 1
    Message was edited by: Barney-15E

  • PlayOptions playMode="pause" How can you get a web show to autostart?

    LR3.2
    I created several Web Albums and want the albums to start immediately without any user interaction.
    I'm assuming that under resources->styles in the style.xml one would use
    Options playMode which has a default setting of pause,
    what are the other parameters this can be set to????
    I'm assuming this is the setting to use for autostarting the Web Album slideshow.
    If this is not how to autostart, then what does one need to do?
    I created several Web Albums with Layout Style Lightroon Flash Gallery.

    From what I have seen on the web this option is not in use and there is no way to autoplay. Sadly

  • HT1391 Purchases show in the Playlist folder /Purchases, but not anywhere else in the Library Album, etc: - how do you get them to show there?

    Songs that I have purchased and downloaded show in the Playlist folder under "Purchased", but not in the Library under Artist, Album etc:.  What do I need to do to have them show under Artist, etc;?

    Download the free iTunes Single of the Week...
    Sounds a bit voodoo I know, but it has a good strike rate.
    tt2

  • HT4101 Once pictures are moved from your camera to your iPad (using the camera connection kit), how do you get the photos off of the iPad? They do not show up in my photo stream or my iCloud.

    Once pictures are moved from your camera to your iPad (using the camera connection kit), how do you get the photos off of the iPad? They do not show up in my photo stream or my iCloud. I am able to see any photo I took on the iPad using the iPad camera (in iTunes, photo stream, or when I open windows explorer and browse the iPad director), however I cannot see any photos transfered from my camera to the iPad. The camera connection kit must have put my photos in a directory I cannot get to and cannot sync.

    The links below have instructions for deleting photos.
    iOS and iPod: Syncing photos using iTunes
    http://support.apple.com/kb/HT4236
    iPad Tip: How to Delete Photos from Your iPad in the Photos App
    http://ipadacademy.com/2011/08/ipad-tip-how-to-delete-photos-from-your-ipad-in-t he-photos-app
    Another Way to Quickly Delete Photos from Your iPad (Mac Only)
    http://ipadacademy.com/2011/09/another-way-to-quickly-delete-photos-from-your-ip ad-mac-only
    How to Delete Photos from iPad
    http://www.wondershare.com/apple-idevice/how-to-delete-photos-from-ipad.html
    How to: Batch Delete Photos on the iPad
    http://www.lifeisaprayer.com/blog/2010/how-batch-delete-photos-ipad
    (With iOS 5.1, use 2 fingers)
    How to Delete Photos from iCloud’s Photo Stream
    http://www.cultofmac.com/124235/how-to-delete-photos-from-iclouds-photo-stream/
     Cheers, Tom

  • How can you get a compilation album to show up as one album rather than be split up but song and artist?

    how can you get a compilation album to show up as one album rather than be split up by song and artist? I've got loads of albums on iTunes that are compliations and they are all mixed up by track/ artist. Even when you click 'show album' it still just shows the album title and then the artist in alphabetical order - so the album is replicated several times
    Can anyone tell me how to amalgamate compliation albums please?

    This web page will help you: http://samsoft.org.uk/iTunes/grouping.asp

  • How do you get your text messages to not show on the screen when they come in

    How do you get your text messages to show on the screen when then come in?  My iphone 3s would just say the persons name and text message.  This says the persons name and the whole message

    Settings > Notifications > Messages > Show Preview - Turn to OFF

Maybe you are looking for

  • Problem of windows10 in HLK

    Hello we progress test now on windows10. but manual type test is not run. another test is not problem and passed. previously, this is not problem when use hck2.0 & 2.1. is this problem of HLK preview version? please give positive consideration. thank

  • Is CS3 better for working with RAW images than Elements 6?

    Hi all, I am trying to find out if it is worth buying CS3 in stead of elements 6. Surprisingly, nobody has been able to tell me what the difference exactly is. The best I got so far was that elements is a trimmed down version of CS3 but what more can

  • Assigning a name when using LVM Format

    Hi I am currently developing an application, which reads 9 Traces from an Agilent Spectrum Analyzer. I am using the TDM File Format for a machine-readable format and the LVM Format (Write to Measurement File Express VI) for a human readable output  p

  • Job terminated in source system  SAPSQL_SQLS_INVALID_CURSOR

    Hi all, can any one help on this issue. I run the BI statistics and found out the error while triggering the delta's Job started Step 001 started (program SBIE0001, variant &0000000000756, user ID Asynchronous transmission of info IDoc 2 in task 0001

  • Export import mandotary patches

    hi, there is a note on metalink :Oracle Support Master Note for Portal Export/Import. Doc ID:      Note:263995.1 it says that there are mandotary patches required for a successfull export - import. For example: 10.1.2.0.2 (**) Patch:5064459 : EXPORT/