Programming exercise

Hi guys! I just started using java and stuck at one exercise, it says:

"Write a program that reads in the amount of a mortgage payment, the outstanding balance (i.e., the amount still owed), and that outputs the amount of the payment that goes to interest and the amount that goes to principal (i.e., the amount that goes to to reducing the debt). Assume the annual interest rate is 6.79%. Use a defined constant for the interest rate. Note that payments are made monthly, so the interest is only one-twelfth of the annual interest of 6.79%."

I wrote this:

package chapter1;

public class Page81prex2 {

public static final double MORTGAGE_INTEREST_RATE=6.79;
public static void main(String[] args) {

double interest=MORTGAGE_INTEREST_RATE/12;
System.out.println("interest rate per month is "+interest);


I know that this might be very easy for you guys, but as I mentioned above I just started and don't wanna skip any exercise undone(i am such a stubborn:)..)so if you give me some tips to the next steps I would be very thankful... Regards.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion