Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Padding decimals in Java

Name: Anonymous 2013-02-03 4:44

How can I pad a double with both trailing zeros (two places, for money) and leading spaces before the $ to align the decimal places?
I want my list to look like:

$###.##
$###.##
_$##.##
__$#.##
__$0.##
__$0.00

As the value decreases. The underscores should be spaces, of course. I wasn't sure if they would appear or be deleted in the post.

Also, I changed a function somewhere and a series of print functions decided to start tabbing every fucking word so they're all spread out and I can't find anything wrong with the code. Any ideas?

System.out.print("\n\nWhat    would    you like    to    do?\n1. Calculate    the Monthly    Payment for    a fixed rate, fixed term loan.\n");
            System.out.print("2.    Calculate the number    of    Months to pay off    a loan with    a fixed monthly payment.\n");
            System.out.print("\nPlease    enter    the number of your selection:    ");

Name: Anonymous 2013-02-03 19:09


`7MMF'   `7MF'                      .d' ""                `7MM        db                           `7MM                                     
  MM       M                        dM`                     MM                                       MM                                     
  MM       M ,pP"Ybd  .gP"Ya       mMMmm`7MM  `7MM  ,p6"bo  MM  ,MP'`7MM  `7MMpMMMb.  .P"Ybmmm       MM  ,pW"Wq.   ,pW"Wq.`7MMpdMAo. ,pP"Ybd
  MM       M 8I   `" ,M'   Yb       MM    MM    MM 6M'  OO  MM ;Y     MM    MM    MM :MI  I8         MM 6W'   `Wb 6W'   `Wb MM   `Wb 8I   `"
  MM       M `YMMMa. 8M""""""       MM    MM    MM 8M       MM;Mm     MM    MM    MM  WmmmP"         MM 8M     M8 8M     M8 MM    M8 `YMMMa.
  YM.     ,M L.   I8 YM.    ,       MM    MM    MM YM.    , MM `Mb.   MM    MM    MM 8M              MM YA.   ,A9 YA.   ,A9 MM   ,AP L.   I8
   `bmmmmd"' M9mmmP'  `Mbmmd'     .JMML.  `Mbod"YML.YMbmd'.JMML. YA..JMML..JMML  JMML.YMMMMMb      .JMML.`Ybmd9'   `Ybmd9'  MMbmmd'  M9mmmP'
                                                                                     6'     dP                              MM              
                                                                                     Ybmmmd'                              .JMML.            
                                                                                                                                            
                                         ,,                                                                                                 
  mm                                     db              mm                                                                                 
  MM                                                     MM                                                                                 
mmMMmm ,pW"Wq.      `7MMpdMAo.`7Mb,od8 `7MM  `7MMpMMMb.mmMMmm     ,pP"Ybd `7MMpdMAo.  ,6"Yb.  ,p6"bo   .gP"Ya  ,pP"Ybd                      
  MM  6W'   `Wb       MM   `Wb  MM' "'   MM    MM    MM  MM       8I   `"   MM   `Wb 8)   MM 6M'  OO  ,M'   Yb 8I   `"                      
  MM  8M     M8       MM    M8  MM       MM    MM    MM  MM       `YMMMa.   MM    M8  ,pm9MM 8M       8M"""""" `YMMMa.                      
  MM  YA.   ,A9       MM   ,AP  MM       MM    MM    MM  MM       L.   I8   MM   ,AP 8M   MM YM.    , YM.    , L.   I8                      
  `Mbmo`Ybmd9'        MMbmmd' .JMML.   .JMML..JMML  JMML.`Mbmo    M9mmmP'   MMbmmd'  `Moo9^Yo.YMbmd'   `Mbmmd' M9mmmP'                      
                      MM                                                    MM                                                              
                    .JMML.                                                .JMML.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List