Results 1 to 2 of 2
  1. #1
    mjayyy is offline Member
    Join Date
    Sep 2015
    Posts
    1
    Rep Power
    0

    Angry Mortgage Calculator Output Problem!

    I'm having a problem with the first loan. at the end it says -$.0. why is it negative? and my output format isn't coming out fully straight why?

    Java Code:
    import java.text.DecimalFormat;
    
    public class MortgageCalculator3 {
    
         public static void main(String[] args)
         {
                int term[] = {7, 15, 30}; //Array for term in years
                double rate[] = {5.35, 5.5, 5.75}; //Array for interest rate
                double principal = 200000; //Principal loan amount
             
             double interestPaid; //Current interest paid
             double principalPaid;//Current principal paid
             int count = 0; //Line count
       
             double updateBalance; //Update principle amount to current balance - update values
             
            
             DecimalFormat two = new DecimalFormat(",###.00"); //round to two decimal places
      
              for(int i = 0; i < 3; i++)
              {
             double interest_rate = rate[i]/1200; //Monthly interest rate
             int yearly_term = term[i] * 12; //Term in months
             double monthlypayment = principal * interest_rate / 
                    (1.0 - Math.pow(interest_rate +1, -yearly_term)); //Calculates monthly payment
             
             //Displays user input
             System.out.println("\n\t Mortgage Payment\n\n" +
    	   	"Principle loan amount: \t$" + principal +
    		"\nInterest Rate (%): \t" + rate[i] + "%" +
    		"\nTerm (Years): \t" + term[i]);
            System.out.println("\nThe monthly payment is: $" + two.format(monthlypayment));
            System.out.println("\n");
            updateBalance = principal; //Updates the principal balance to current balance 
             
    
            int paymentNum = 1;
             //Starts loop for payment over the term of the loan
                 for (int j=1; paymentNum <=yearly_term ;j++){
                        
                 interestPaid = updateBalance * interest_rate; //Interest paid formula calculation
                 principalPaid = monthlypayment - interestPaid;//Principal paid formula calculation
                 updateBalance = updateBalance - principalPaid;//Current balance formula calculator
              
                 //line count to delay list
                 if(count==20)
                 {
                     count = 0;
                     try{
                         Thread.sleep(2000);
                     }
                     catch (InterruptedException e)
                     {
                     }
                     }
                 else
                 {
                     count++;
                 }
                 
                 System.out.println(yearly_term + "\t\t$" + two.format(interestPaid) +
                             "\t\t$" + two.format(principalPaid) +
                             "\t\t$" + two.format(updateBalance));   
                 
                 yearly_term--; 
                 
                }
              }
              
         }
    
    }

    XML Code:
    run:
    
    	 Mortgage Payment
    
    Principle loan amount: 	$200000.0
    Interest Rate (%): 	5.35%
    Term (Years): 	7
    
    The monthly payment is: $2,859.79
    
    
    84		$891.67		$1,968.12		$198,031.88
    83		$882.89		$1,976.90		$196,054.98
    82		$874.08		$1,985.71		$194,069.27
    81		$865.23		$1,994.57		$192,074.70
    80		$856.33		$2,003.46		$190,071.24
    79		$847.40		$2,012.39		$188,058.85
    78		$838.43		$2,021.36		$186,037.49
    77		$829.42		$2,030.37		$184,007.12
    76		$820.37		$2,039.43		$181,967.69
    75		$811.27		$2,048.52		$179,919.18
    74		$802.14		$2,057.65		$177,861.52
    73		$792.97		$2,066.82		$175,794.70
    72		$783.75		$2,076.04		$173,718.66
    71		$774.50		$2,085.29		$171,633.37
    70		$765.20		$2,094.59		$169,538.77
    69		$755.86		$2,103.93		$167,434.84
    68		$746.48		$2,113.31		$165,321.53
    67		$737.06		$2,122.73		$163,198.80
    66		$727.59		$2,132.20		$161,066.61
    65		$718.09		$2,141.70		$158,924.90
    64		$708.54		$2,151.25		$156,773.65
    63		$698.95		$2,160.84		$154,612.81
    62		$689.32		$2,170.48		$152,442.34
    61		$679.64		$2,180.15		$150,262.19
    60		$669.92		$2,189.87		$148,072.31
    59		$660.16		$2,199.63		$145,872.68
    58		$650.35		$2,209.44		$143,663.24
    57		$640.50		$2,219.29		$141,443.95
    56		$630.60		$2,229.19		$139,214.76
    55		$620.67		$2,239.12		$136,975.64
    54		$610.68		$2,249.11		$134,726.53
    53		$600.66		$2,259.13		$132,467.39
    52		$590.58		$2,269.21		$130,198.19
    51		$580.47		$2,279.32		$127,918.86
    50		$570.30		$2,289.49		$125,629.38
    49		$560.10		$2,299.69		$123,329.68
    48		$549.84		$2,309.95		$121,019.74
    47		$539.55		$2,320.24		$118,699.49
    46		$529.20		$2,330.59		$116,368.91
    45		$518.81		$2,340.98		$114,027.93
    44		$508.37		$2,351.42		$111,676.51
    43		$497.89		$2,361.90		$109,314.61
    42		$487.36		$2,372.43		$106,942.18
    41		$476.78		$2,383.01		$104,559.18
    40		$466.16		$2,393.63		$102,165.54
    39		$455.49		$2,404.30		$99,761.24
    38		$444.77		$2,415.02		$97,346.22
    37		$434.00		$2,425.79		$94,920.43
    36		$423.19		$2,436.60		$92,483.83
    35		$412.32		$2,447.47		$90,036.36
    34		$401.41		$2,458.38		$87,577.98
    33		$390.45		$2,469.34		$85,108.64
    32		$379.44		$2,480.35		$82,628.30
    31		$368.38		$2,491.41		$80,136.89
    30		$357.28		$2,502.51		$77,634.38
    29		$346.12		$2,513.67		$75,120.71
    28		$334.91		$2,524.88		$72,595.83
    27		$323.66		$2,536.13		$70,059.70
    26		$312.35		$2,547.44		$67,512.25
    25		$300.99		$2,558.80		$64,953.46
    24		$289.58		$2,570.21		$62,383.25
    23		$278.13		$2,581.67		$59,801.58
    22		$266.62		$2,593.18		$57,208.41
    21		$255.05		$2,604.74		$54,603.67
    20		$243.44		$2,616.35		$51,987.32
    19		$231.78		$2,628.01		$49,359.31
    18		$220.06		$2,639.73		$46,719.58
    17		$208.29		$2,651.50		$44,068.08
    16		$196.47		$2,663.32		$41,404.76
    15		$184.60		$2,675.19		$38,729.57
    14		$172.67		$2,687.12		$36,042.45
    13		$160.69		$2,699.10		$33,343.34
    12		$148.66		$2,711.13		$30,632.21
    11		$136.57		$2,723.22		$27,908.99
    10		$124.43		$2,735.36		$25,173.62
    9		$112.23		$2,747.56		$22,426.07
    8		$99.98		$2,759.81		$19,666.26
    7		$87.68		$2,772.11		$16,894.15
    6		$75.32		$2,784.47		$14,109.68
    5		$62.91		$2,796.88		$11,312.79
    4		$50.44		$2,809.35		$8,503.44
    3		$37.91		$2,821.88		$5,681.56
    2		$25.33		$2,834.46		$2,847.10
    1		$12.69		$2,847.10		$-.00
    
    	 Mortgage Payment
    
    Principle loan amount: 	$200000.0
    Interest Rate (%): 	5.5%
    Term (Years): 	15
    
    The monthly payment is: $1,634.17
    
    
    180		$916.67		$717.50		$199,282.50
    179		$913.38		$720.79		$198,561.71
    178		$910.07		$724.09		$197,837.62
    177		$906.76		$727.41		$197,110.21
    176		$903.42		$730.75		$196,379.46
    175		$900.07		$734.09		$195,645.37
    174		$896.71		$737.46		$194,907.91
    173		$893.33		$740.84		$194,167.07
    172		$889.93		$744.23		$193,422.84
    171		$886.52		$747.65		$192,675.19
    170		$883.09		$751.07		$191,924.12
    169		$879.65		$754.51		$191,169.60
    168		$876.19		$757.97		$190,411.63
    167		$872.72		$761.45		$189,650.18
    166		$869.23		$764.94		$188,885.25
    165		$865.72		$768.44		$188,116.80
    164		$862.20		$771.96		$187,344.84
    163		$858.66		$775.50		$186,569.34
    162		$855.11		$779.06		$185,790.28
    161		$851.54		$782.63		$185,007.65
    160		$847.95		$786.22		$184,221.43
    159		$844.35		$789.82		$183,431.62
    158		$840.73		$793.44		$182,638.18
    157		$837.09		$797.08		$181,841.10
    156		$833.44		$800.73		$181,040.37
    155		$829.77		$804.40		$180,235.97
    154		$826.08		$808.09		$179,427.89
    153		$822.38		$811.79		$178,616.10
    152		$818.66		$815.51		$177,800.59
    151		$814.92		$819.25		$176,981.34
    150		$811.16		$823.00		$176,158.34
    149		$807.39		$826.77		$175,331.57
    148		$803.60		$830.56		$174,501.00
    147		$799.80		$834.37		$173,666.63
    146		$795.97		$838.19		$172,828.44
    145		$792.13		$842.04		$171,986.40
    144		$788.27		$845.90		$171,140.50
    143		$784.39		$849.77		$170,290.73
    142		$780.50		$853.67		$169,437.06
    141		$776.59		$857.58		$168,579.48
    140		$772.66		$861.51		$167,717.97
    139		$768.71		$865.46		$166,852.51
    138		$764.74		$869.43		$165,983.09
    137		$760.76		$873.41		$165,109.68
    136		$756.75		$877.41		$164,232.26
    135		$752.73		$881.44		$163,350.83
    134		$748.69		$885.48		$162,465.35
    133		$744.63		$889.53		$161,575.82
    132		$740.56		$893.61		$160,682.20
    131		$736.46		$897.71		$159,784.50
    130		$732.35		$901.82		$158,882.68
    129		$728.21		$905.95		$157,976.72
    128		$724.06		$910.11		$157,066.62
    127		$719.89		$914.28		$156,152.34
    126		$715.70		$918.47		$155,233.87
    125		$711.49		$922.68		$154,311.19
    124		$707.26		$926.91		$153,384.28
    123		$703.01		$931.16		$152,453.13
    122		$698.74		$935.42		$151,517.70
    121		$694.46		$939.71		$150,577.99
    120		$690.15		$944.02		$149,633.97
    119		$685.82		$948.34		$148,685.63
    118		$681.48		$952.69		$147,732.94
    117		$677.11		$957.06		$146,775.88
    116		$672.72		$961.44		$145,814.44
    115		$668.32		$965.85		$144,848.59
    114		$663.89		$970.28		$143,878.31
    113		$659.44		$974.72		$142,903.58
    112		$654.97		$979.19		$141,924.39
    111		$650.49		$983.68		$140,940.71
    110		$645.98		$988.19		$139,952.52
    109		$641.45		$992.72		$138,959.81
    108		$636.90		$997.27		$137,962.54
    107		$632.33		$1,001.84		$136,960.70
    106		$627.74		$1,006.43		$135,954.27
    105		$623.12		$1,011.04		$134,943.23
    104		$618.49		$1,015.68		$133,927.55
    103		$613.83		$1,020.33		$132,907.22
    102		$609.16		$1,025.01		$131,882.21
    101		$604.46		$1,029.71		$130,852.50
    100		$599.74		$1,034.43		$129,818.07
    99		$595.00		$1,039.17		$128,778.91
    98		$590.24		$1,043.93		$127,734.98
    97		$585.45		$1,048.71		$126,686.26
    96		$580.65		$1,053.52		$125,632.74
    95		$575.82		$1,058.35		$124,574.39
    94		$570.97		$1,063.20		$123,511.19
    93		$566.09		$1,068.07		$122,443.12
    92		$561.20		$1,072.97		$121,370.15
    91		$556.28		$1,077.89		$120,292.26
    90		$551.34		$1,082.83		$119,209.43
    89		$546.38		$1,087.79		$118,121.64
    88		$541.39		$1,092.78		$117,028.87
    87		$536.38		$1,097.78		$115,931.08
    86		$531.35		$1,102.82		$114,828.26
    85		$526.30		$1,107.87		$113,720.39
    84		$521.22		$1,112.95		$112,607.45
    83		$516.12		$1,118.05		$111,489.40
    82		$510.99		$1,123.17		$110,366.22
    81		$505.85		$1,128.32		$109,237.90
    80		$500.67		$1,133.49		$108,104.41
    79		$495.48		$1,138.69		$106,965.72
    78		$490.26		$1,143.91		$105,821.81
    77		$485.02		$1,149.15		$104,672.66
    76		$479.75		$1,154.42		$103,518.24
    75		$474.46		$1,159.71		$102,358.54
    74		$469.14		$1,165.02		$101,193.51
    73		$463.80		$1,170.36		$100,023.15
    72		$458.44		$1,175.73		$98,847.42
    71		$453.05		$1,181.12		$97,666.30
    70		$447.64		$1,186.53		$96,479.78
    69		$442.20		$1,191.97		$95,287.81
    68		$436.74		$1,197.43		$94,090.38
    67		$431.25		$1,202.92		$92,887.46
    66		$425.73		$1,208.43		$91,679.02
    65		$420.20		$1,213.97		$90,465.05
    64		$414.63		$1,219.54		$89,245.52
    63		$409.04		$1,225.12		$88,020.39
    62		$403.43		$1,230.74		$86,789.65
    61		$397.79		$1,236.38		$85,553.27
    60		$392.12		$1,242.05		$84,311.22
    59		$386.43		$1,247.74		$83,063.48
    58		$380.71		$1,253.46		$81,810.02
    57		$374.96		$1,259.20		$80,550.82
    56		$369.19		$1,264.98		$79,285.84
    55		$363.39		$1,270.77		$78,015.07
    54		$357.57		$1,276.60		$76,738.47
    53		$351.72		$1,282.45		$75,456.02
    52		$345.84		$1,288.33		$74,167.70
    51		$339.94		$1,294.23		$72,873.47
    50		$334.00		$1,300.16		$71,573.30
    49		$328.04		$1,306.12		$70,267.18
    48		$322.06		$1,312.11		$68,955.07
    47		$316.04		$1,318.12		$67,636.95
    46		$310.00		$1,324.16		$66,312.78
    45		$303.93		$1,330.23		$64,982.55
    44		$297.84		$1,336.33		$63,646.22
    43		$291.71		$1,342.46		$62,303.76
    42		$285.56		$1,348.61		$60,955.16
    41		$279.38		$1,354.79		$59,600.37
    40		$273.17		$1,361.00		$58,239.37
    39		$266.93		$1,367.24		$56,872.13
    38		$260.66		$1,373.50		$55,498.63
    37		$254.37		$1,379.80		$54,118.83
    36		$248.04		$1,386.12		$52,732.71
    35		$241.69		$1,392.48		$51,340.23
    34		$235.31		$1,398.86		$49,941.38
    33		$228.90		$1,405.27		$48,536.11
    32		$222.46		$1,411.71		$47,124.40
    31		$215.99		$1,418.18		$45,706.22
    30		$209.49		$1,424.68		$44,281.54
    29		$202.96		$1,431.21		$42,850.33
    28		$196.40		$1,437.77		$41,412.56
    27		$189.81		$1,444.36		$39,968.20
    26		$183.19		$1,450.98		$38,517.22
    25		$176.54		$1,457.63		$37,059.59
    24		$169.86		$1,464.31		$35,595.28
    23		$163.15		$1,471.02		$34,124.26
    22		$156.40		$1,477.76		$32,646.49
    21		$149.63		$1,484.54		$31,161.96
    20		$142.83		$1,491.34		$29,670.61
    19		$135.99		$1,498.18		$28,172.44
    18		$129.12		$1,505.04		$26,667.39
    17		$122.23		$1,511.94		$25,155.45
    16		$115.30		$1,518.87		$23,636.58
    15		$108.33		$1,525.83		$22,110.75
    14		$101.34		$1,532.83		$20,577.92
    13		$94.32		$1,539.85		$19,038.07
    12		$87.26		$1,546.91		$17,491.16
    11		$80.17		$1,554.00		$15,937.16
    10		$73.05		$1,561.12		$14,376.04
    9		$65.89		$1,568.28		$12,807.77
    8		$58.70		$1,575.46		$11,232.30
    7		$51.48		$1,582.69		$9,649.62
    6		$44.23		$1,589.94		$8,059.68
    5		$36.94		$1,597.23		$6,462.45
    4		$29.62		$1,604.55		$4,857.90
    3		$22.27		$1,611.90		$3,246.00
    2		$14.88		$1,619.29		$1,626.71
    1		$7.46		$1,626.71		$.00
    
    	 Mortgage Payment
    
    Principle loan amount: 	$200000.0
    Interest Rate (%): 	5.75%
    Term (Years): 	30
    
    The monthly payment is: $1,167.15
    
    
    360		$958.33		$208.81		$199,791.19
    359		$957.33		$209.81		$199,581.37
    358		$956.33		$210.82		$199,370.56
    357		$955.32		$211.83		$199,158.73
    356		$954.30		$212.84		$198,945.88
    355		$953.28		$213.86		$198,732.02
    354		$952.26		$214.89		$198,517.13
    353		$951.23		$215.92		$198,301.22
    352		$950.19		$216.95		$198,084.26
    351		$949.15		$217.99		$197,866.27
    350		$948.11		$219.04		$197,647.23
    349		$947.06		$220.09		$197,427.15
    348		$946.01		$221.14		$197,206.01
    347		$944.95		$222.20		$196,983.81
    346		$943.88		$223.26		$196,760.54
    345		$942.81		$224.33		$196,536.21
    344		$941.74		$225.41		$196,310.80
    343		$940.66		$226.49		$196,084.31
    342		$939.57		$227.58		$195,856.73
    341		$938.48		$228.67		$195,628.07
    340		$937.38		$229.76		$195,398.31
    339		$936.28		$230.86		$195,167.44
    338		$935.18		$231.97		$194,935.48
    337		$934.07		$233.08		$194,702.40
    336		$932.95		$234.20		$194,468.20
    335		$931.83		$235.32		$194,232.88
    334		$930.70		$236.45		$193,996.43
    333		$929.57		$237.58		$193,758.85
    332		$928.43		$238.72		$193,520.14
    331		$927.28		$239.86		$193,280.27
    330		$926.13		$241.01		$193,039.26
    329		$924.98		$242.17		$192,797.10
    328		$923.82		$243.33		$192,553.77
    327		$922.65		$244.49		$192,309.28
    326		$921.48		$245.66		$192,063.62
    325		$920.30		$246.84		$191,816.77
    324		$919.12		$248.02		$191,568.75
    323		$917.93		$249.21		$191,319.54
    322		$916.74		$250.41		$191,069.13
    321		$915.54		$251.61		$190,817.53
    320		$914.33		$252.81		$190,564.71
    319		$913.12		$254.02		$190,310.69
    318		$911.91		$255.24		$190,055.45
    317		$910.68		$256.46		$189,798.99
    316		$909.45		$257.69		$189,541.30
    315		$908.22		$258.93		$189,282.37
    314		$906.98		$260.17		$189,022.20
    313		$905.73		$261.41		$188,760.79
    312		$904.48		$262.67		$188,498.12
    311		$903.22		$263.93		$188,234.19
    310		$901.96		$265.19		$187,969.00
    309		$900.68		$266.46		$187,702.54
    308		$899.41		$267.74		$187,434.81
    307		$898.13		$269.02		$187,165.78
    306		$896.84		$270.31		$186,895.48
    305		$895.54		$271.60		$186,623.87
    304		$894.24		$272.91		$186,350.96
    303		$892.93		$274.21		$186,076.75
    302		$891.62		$275.53		$185,801.22
    301		$890.30		$276.85		$185,524.37
    300		$888.97		$278.17		$185,246.20
    299		$887.64		$279.51		$184,966.69
    298		$886.30		$280.85		$184,685.84
    297		$884.95		$282.19		$184,403.65
    296		$883.60		$283.54		$184,120.11
    295		$882.24		$284.90		$183,835.20
    294		$880.88		$286.27		$183,548.93
    293		$879.51		$287.64		$183,261.29
    292		$878.13		$289.02		$182,972.28
    291		$876.74		$290.40		$182,681.87
    290		$875.35		$291.80		$182,390.08
    289		$873.95		$293.19		$182,096.88
    288		$872.55		$294.60		$181,802.29
    287		$871.14		$296.01		$181,506.28
    286		$869.72		$297.43		$181,208.85
    285		$868.29		$298.85		$180,909.99
    284		$866.86		$300.29		$180,609.71
    283		$865.42		$301.72		$180,307.98
    282		$863.98		$303.17		$180,004.81
    281		$862.52		$304.62		$179,700.19
    280		$861.06		$306.08		$179,394.11
    279		$859.60		$307.55		$179,086.56
    278		$858.12		$309.02		$178,777.54
    277		$856.64		$310.50		$178,467.03
    276		$855.15		$311.99		$178,155.04
    275		$853.66		$313.49		$177,841.56
    274		$852.16		$314.99		$177,526.57
    273		$850.65		$316.50		$177,210.07
    272		$849.13		$318.01		$176,892.06
    271		$847.61		$319.54		$176,572.52
    270		$846.08		$321.07		$176,251.45
    269		$844.54		$322.61		$175,928.84
    268		$842.99		$324.15		$175,604.69
    267		$841.44		$325.71		$175,278.98
    266		$839.88		$327.27		$174,951.72
    265		$838.31		$328.84		$174,622.88
    264		$836.73		$330.41		$174,292.47
    263		$835.15		$331.99		$173,960.48
    262		$833.56		$333.59		$173,626.89
    261		$831.96		$335.18		$173,291.71
    260		$830.36		$336.79		$172,954.92
    259		$828.74		$338.40		$172,616.51
    258		$827.12		$340.02		$172,276.49
    257		$825.49		$341.65		$171,934.83
    256		$823.85		$343.29		$171,591.54
    255		$822.21		$344.94		$171,246.61
    254		$820.56		$346.59		$170,900.02
    253		$818.90		$348.25		$170,551.77
    252		$817.23		$349.92		$170,201.85
    251		$815.55		$351.60		$169,850.25
    250		$813.87		$353.28		$169,496.97
    249		$812.17		$354.97		$169,142.00
    248		$810.47		$356.67		$168,785.33
    247		$808.76		$358.38		$168,426.95
    246		$807.05		$360.10		$168,066.85
    245		$805.32		$361.83		$167,705.02
    244		$803.59		$363.56		$167,341.46
    243		$801.84		$365.30		$166,976.16
    242		$800.09		$367.05		$166,609.11
    241		$798.34		$368.81		$166,240.30
    240		$796.57		$370.58		$165,869.72
    239		$794.79		$372.35		$165,497.37
    238		$793.01		$374.14		$165,123.23
    237		$791.22		$375.93		$164,747.30
    236		$789.41		$377.73		$164,369.57
    235		$787.60		$379.54		$163,990.03
    234		$785.79		$381.36		$163,608.67
    233		$783.96		$383.19		$163,225.48
    232		$782.12		$385.02		$162,840.45
    231		$780.28		$386.87		$162,453.59
    230		$778.42		$388.72		$162,064.86
    229		$776.56		$390.58		$161,674.28
    228		$774.69		$392.46		$161,281.82
    227		$772.81		$394.34		$160,887.49
    226		$770.92		$396.23		$160,491.26
    225		$769.02		$398.13		$160,093.13
    224		$767.11		$400.03		$159,693.10
    223		$765.20		$401.95		$159,291.15
    222		$763.27		$403.88		$158,887.28
    221		$761.33		$405.81		$158,481.46
    220		$759.39		$407.76		$158,073.71
    219		$757.44		$409.71		$157,664.00
    218		$755.47		$411.67		$157,252.33
    217		$753.50		$413.64		$156,838.68
    216		$751.52		$415.63		$156,423.06
    215		$749.53		$417.62		$156,005.44
    214		$747.53		$419.62		$155,585.82
    213		$745.52		$421.63		$155,164.19
    212		$743.50		$423.65		$154,740.54
    211		$741.47		$425.68		$154,314.86
    210		$739.43		$427.72		$153,887.14
    209		$737.38		$429.77		$153,457.37
    208		$735.32		$431.83		$153,025.54
    207		$733.25		$433.90		$152,591.64
    206		$731.17		$435.98		$152,155.66
    205		$729.08		$438.07		$151,717.59
    204		$726.98		$440.17		$151,277.43
    203		$724.87		$442.27		$150,835.15
    202		$722.75		$444.39		$150,390.76
    201		$720.62		$446.52		$149,944.24
    200		$718.48		$448.66		$149,495.57
    199		$716.33		$450.81		$149,044.76
    198		$714.17		$452.97		$148,591.79
    197		$712.00		$455.14		$148,136.64
    196		$709.82		$457.32		$147,679.32
    195		$707.63		$459.52		$147,219.81
    194		$705.43		$461.72		$146,758.09
    193		$703.22		$463.93		$146,294.16
    192		$700.99		$466.15		$145,828.00
    191		$698.76		$468.39		$145,359.62
    190		$696.51		$470.63		$144,888.99
    189		$694.26		$472.89		$144,416.10
    188		$691.99		$475.15		$143,940.95
    187		$689.72		$477.43		$143,463.52
    186		$687.43		$479.72		$142,983.80
    185		$685.13		$482.01		$142,501.79
    184		$682.82		$484.32		$142,017.46
    183		$680.50		$486.65		$141,530.82
    182		$678.17		$488.98		$141,041.84
    181		$675.83		$491.32		$140,550.52
    180		$673.47		$493.67		$140,056.85
    179		$671.11		$496.04		$139,560.81
    178		$668.73		$498.42		$139,062.39
    177		$666.34		$500.81		$138,561.59
    176		$663.94		$503.20		$138,058.38
    175		$661.53		$505.62		$137,552.76
    174		$659.11		$508.04		$137,044.73
    173		$656.67		$510.47		$136,534.25
    172		$654.23		$512.92		$136,021.33
    171		$651.77		$515.38		$135,505.96
    170		$649.30		$517.85		$134,988.11
    169		$646.82		$520.33		$134,467.78
    168		$644.32		$522.82		$133,944.96
    167		$641.82		$525.33		$133,419.64
    166		$639.30		$527.84		$132,891.79
    165		$636.77		$530.37		$132,361.42
    164		$634.23		$532.91		$131,828.51
    163		$631.68		$535.47		$131,293.04
    162		$629.11		$538.03		$130,755.01
    161		$626.53		$540.61		$130,214.39
    160		$623.94		$543.20		$129,671.19
    159		$621.34		$545.80		$129,125.39
    158		$618.73		$548.42		$128,576.97
    157		$616.10		$551.05		$128,025.92
    156		$613.46		$553.69		$127,472.23
    155		$610.80		$556.34		$126,915.89
    154		$608.14		$559.01		$126,356.88
    153		$605.46		$561.69		$125,795.20
    152		$602.77		$564.38		$125,230.82
    151		$600.06		$567.08		$124,663.74
    150		$597.35		$569.80		$124,093.94
    149		$594.62		$572.53		$123,521.41
    148		$591.87		$575.27		$122,946.14
    147		$589.12		$578.03		$122,368.11
    146		$586.35		$580.80		$121,787.31
    145		$583.56		$583.58		$121,203.73
    144		$580.77		$586.38		$120,617.35
    143		$577.96		$589.19		$120,028.17
    142		$575.13		$592.01		$119,436.16
    141		$572.30		$594.85		$118,841.31
    140		$569.45		$597.70		$118,243.61
    139		$566.58		$600.56		$117,643.05
    138		$563.71		$603.44		$117,039.61
    137		$560.81		$606.33		$116,433.28
    136		$557.91		$609.24		$115,824.04
    135		$554.99		$612.16		$115,211.89
    134		$552.06		$615.09		$114,596.80
    133		$549.11		$618.04		$113,978.76
    132		$546.15		$621.00		$113,357.76
    131		$543.17		$623.97		$112,733.79
    130		$540.18		$626.96		$112,106.83
    129		$537.18		$629.97		$111,476.86
    128		$534.16		$632.99		$110,843.87
    127		$531.13		$636.02		$110,207.86
    126		$528.08		$639.07		$109,568.79
    125		$525.02		$642.13		$108,926.66
    124		$521.94		$645.21		$108,281.46
    123		$518.85		$648.30		$107,633.16
    122		$515.74		$651.40		$106,981.75
    121		$512.62		$654.52		$106,327.23
    120		$509.48		$657.66		$105,669.57
    119		$506.33		$660.81		$105,008.76
    118		$503.17		$663.98		$104,344.78
    117		$499.99		$667.16		$103,677.62
    116		$496.79		$670.36		$103,007.26
    115		$493.58		$673.57		$102,333.69
    114		$490.35		$676.80		$101,656.89
    113		$487.11		$680.04		$100,976.85
    112		$483.85		$683.30		$100,293.56
    111		$480.57		$686.57		$99,606.98
    110		$477.28		$689.86		$98,917.12
    109		$473.98		$693.17		$98,223.95
    108		$470.66		$696.49		$97,527.46
    107		$467.32		$699.83		$96,827.64
    106		$463.97		$703.18		$96,124.46
    105		$460.60		$706.55		$95,417.91
    104		$457.21		$709.93		$94,707.97
    103		$453.81		$713.34		$93,994.64
    102		$450.39		$716.75		$93,277.88
    101		$446.96		$720.19		$92,557.69
    100		$443.51		$723.64		$91,834.05
    99		$440.04		$727.11		$91,106.95
    98		$436.55		$730.59		$90,376.35
    97		$433.05		$734.09		$89,642.26
    96		$429.54		$737.61		$88,904.65
    95		$426.00		$741.14		$88,163.51
    94		$422.45		$744.70		$87,418.81
    93		$418.88		$748.26		$86,670.55
    92		$415.30		$751.85		$85,918.70
    91		$411.69		$755.45		$85,163.25
    90		$408.07		$759.07		$84,404.17
    89		$404.44		$762.71		$83,641.47
    88		$400.78		$766.36		$82,875.10
    87		$397.11		$770.04		$82,105.07
    86		$393.42		$773.73		$81,331.34
    85		$389.71		$777.43		$80,553.91
    84		$385.99		$781.16		$79,772.75
    83		$382.24		$784.90		$78,987.85
    82		$378.48		$788.66		$78,199.19
    81		$374.70		$792.44		$77,406.74
    80		$370.91		$796.24		$76,610.51
    79		$367.09		$800.05		$75,810.45
    78		$363.26		$803.89		$75,006.57
    77		$359.41		$807.74		$74,198.83
    76		$355.54		$811.61		$73,387.22
    75		$351.65		$815.50		$72,571.72
    74		$347.74		$819.41		$71,752.31
    73		$343.81		$823.33		$70,928.98
    72		$339.87		$827.28		$70,101.70
    71		$335.90		$831.24		$69,270.46
    70		$331.92		$835.22		$68,435.23
    69		$327.92		$839.23		$67,596.01
    68		$323.90		$843.25		$66,752.76
    67		$319.86		$847.29		$65,905.47
    66		$315.80		$851.35		$65,054.12
    65		$311.72		$855.43		$64,198.69
    64		$307.62		$859.53		$63,339.17
    63		$303.50		$863.65		$62,475.52
    62		$299.36		$867.78		$61,607.74
    61		$295.20		$871.94		$60,735.80
    60		$291.03		$876.12		$59,859.68
    59		$286.83		$880.32		$58,979.36
    58		$282.61		$884.54		$58,094.82
    57		$278.37		$888.77		$57,206.05
    56		$274.11		$893.03		$56,313.01
    55		$269.83		$897.31		$55,415.70
    54		$265.53		$901.61		$54,514.09
    53		$261.21		$905.93		$53,608.16
    52		$256.87		$910.27		$52,697.88
    51		$252.51		$914.64		$51,783.25
    50		$248.13		$919.02		$50,864.23
    49		$243.72		$923.42		$49,940.81
    48		$239.30		$927.85		$49,012.96
    47		$234.85		$932.29		$48,080.67
    46		$230.39		$936.76		$47,143.91
    45		$225.90		$941.25		$46,202.66
    44		$221.39		$945.76		$45,256.91
    43		$216.86		$950.29		$44,306.62
    42		$212.30		$954.84		$43,351.77
    41		$207.73		$959.42		$42,392.35
    40		$203.13		$964.02		$41,428.34
    39		$198.51		$968.63		$40,459.70
    38		$193.87		$973.28		$39,486.43
    37		$189.21		$977.94		$38,508.49
    36		$184.52		$982.63		$37,525.86
    35		$179.81		$987.33		$36,538.53
    34		$175.08		$992.07		$35,546.46
    33		$170.33		$996.82		$34,549.64
    32		$165.55		$1,001.60		$33,548.05
    31		$160.75		$1,006.39		$32,541.65
    30		$155.93		$1,011.22		$31,530.44
    29		$151.08		$1,016.06		$30,514.37
    28		$146.21		$1,020.93		$29,493.44
    27		$141.32		$1,025.82		$28,467.62
    26		$136.41		$1,030.74		$27,436.88
    25		$131.47		$1,035.68		$26,401.20
    24		$126.51		$1,040.64		$25,360.56
    23		$121.52		$1,045.63		$24,314.94
    22		$116.51		$1,050.64		$23,264.30
    21		$111.47		$1,055.67		$22,208.63
    20		$106.42		$1,060.73		$21,147.90
    19		$101.33		$1,065.81		$20,082.09
    18		$96.23		$1,070.92		$19,011.17
    17		$91.10		$1,076.05		$17,935.12
    16		$85.94		$1,081.21		$16,853.91
    15		$80.76		$1,086.39		$15,767.53
    14		$75.55		$1,091.59		$14,675.93
    13		$70.32		$1,096.82		$13,579.11
    12		$65.07		$1,102.08		$12,477.03
    11		$59.79		$1,107.36		$11,369.67
    10		$54.48		$1,112.67		$10,257.00
    9		$49.15		$1,118.00		$9,139.01
    8		$43.79		$1,123.35		$8,015.65
    7		$38.41		$1,128.74		$6,886.91
    6		$33.00		$1,134.15		$5,752.77
    5		$27.57		$1,139.58		$4,613.19
    4		$22.10		$1,145.04		$3,468.15
    3		$16.62		$1,150.53		$2,317.62
    2		$11.11		$1,156.04		$1,161.58
    1		$5.57		$1,161.58		$.00

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: Mortgage Calculator Output Problem!

    Your output is messed up because you can't depend on the tabs to format properly when the fields increase in size. You need to change your format specification (or use System.out.printf()). The 0 is probably negative because the number is not really 0 but a very small negative fraction due to the problems with floating point math. So it rounds to -.0.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Mortgage Calculator
    By missmara77 in forum New To Java
    Replies: 5
    Last Post: 09-05-2011, 07:37 PM
  2. mortgage calculator
    By scooter24 in forum New To Java
    Replies: 3
    Last Post: 06-26-2011, 02:21 PM
  3. Mortgage Calculator
    By rsmithjr316 in forum New To Java
    Replies: 14
    Last Post: 01-21-2011, 10:53 PM
  4. Mortgage Calculator
    By pablo2002 in forum Java Applets
    Replies: 3
    Last Post: 09-25-2010, 10:34 PM
  5. mortgage calculator help
    By kalibballer in forum New To Java
    Replies: 1
    Last Post: 03-26-2009, 11:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •