# Decimal places

Page 1 of 1

## 1 Replies - 1781 Views - Last Post: 12 June 2007 - 09:18 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=29338&amp;s=ce9370b1382047a66e2ab5da548ec697&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 PonyDriver

Reputation: 0
• Posts: 18
• Joined: 27-April 07

# Decimal places

Posted 12 June 2007 - 07:58 PM

Hi,

I was hoping someone could point me in the direction of two decimal places. Thank you in advance.

```/*
Week 2:			Mortgage Calculator
Programmer:		Tim Shannon
Date:			June 11, 2007
Filename:		MtgCalc.java
Purpose:		This project calculates and displays
the monthly payment amount to fully
amortize a \$200,000.00 loan over a 30
year term at 5.75% interest.
*/

public class MtgCalc1
{
public static void main(String[] args)
{

// Declare and build variables
int LoanAmt=200000;
int LoanTrm=360;
double Interest=.0575;
double MonthlyPmt=0;

// Display mortgage calculator
System.out.println("\t\t\tMortgage Calculator");
System.out.println("\t\t\tThe loan amount is \$200,000");
System.out.println("\t\t\tThe term of the loan is 30 years");
System.out.println("\t\t\tThe interest rate is 5.75%");
System.out.println();

// Declare formula
MonthlyPmt=(LoanAmt*(Interest/12))/(1-1/Math.pow((1+Interest/12), LoanTrm));

System.out.println("\t\t\tThe monthly payment is: \$"+MonthlyPmt);
System.out.println();

}
}

```

Pony

Is This A Good Question/Topic? 0

## Replies To: Decimal places

### #2 PennyBoki

• D.I.C Lover

Reputation: 55
• Posts: 2,345
• Joined: 11-December 06

## Re: Decimal places

Posted 12 June 2007 - 09:18 PM

Hi, I'm sure if look around this very java forum you can find what you are looking for. You can use the DecimalFormat class, here is a link that I just googled link