Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Arrays for mortgage calc

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Arrays for mortgage calc

    Hi can somebody please help me or give me some direction on how I am supposed to do this: Write the program in Java (without a graphical user interface) and have it calculate the payment amount for 3 mortgage loans:
    * - 7 year at 5.35%
    * - 15 year at 5.5%
    * - 30 year at 5.75%
    Use an array for the different loans. Display the mortgage payment amount for each loan.
    I dont even know if I am even close with the arrays but I think I need to add formulas to this to. I just am completely lost. Here is what I have. (I know I am not even close) Please help!!

    package mortgagecalculator2;

    /**
    *
    * @author
    */
    public class MortgageCalculator2 {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    double loanAmount[]=new double[1];
    loanAmount[0]=200000.00;

    double loanLengthInMonths[]=new double[3];
    loanLengthInMonths[0]=84;
    loanLengthInMonths[1]=180;
    loanLengthInMonths[2]=360;

    double monthlyInterest[]=new double[3];
    monthlyInterest[0]=5.35;
    monthlyInterest[1]=5.5;
    monthlyInterest[2]=5.75;


    System.out.println(loanAmount[0]);
    System.out.println(loanLengthInMonths[0]);
    System.out.println(monthlyInterest[0]);
    System.out.println(loanAmount[0]);
    System.out.println(loanLengthInMonths[1]);
    System.out.println(monthlyInterest[1]);
    System.out.println(loanAmount[0]);
    System.out.println(loanLengthInMonths[2]);
    System.out.println(monthlyInterest[2]);

    }



    }


  2. #2
    Member
    Join Date
    Dec 2011
    Location
    United States
    Posts
    94
    My Mood
    Amused
    Thanks
    5
    Thanked 8 Times in 8 Posts

    Default Re: Arrays for mortgage calc

    Do you need arrays to solve this problem at all? Looks like using simple math operations can give you what you need.

  3. #3
    Junior Member
    Join Date
    Dec 2011
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Arrays for mortgage calc

    Yes it is required by the instructor to use arrays.

Similar Threads

  1. Help with arrays
    By mike2452 in forum Collections and Generics
    Replies: 6
    Last Post: August 6th, 2011, 12:15 PM
  2. Need Help with Arrays
    By zennbang in forum Object Oriented Programming
    Replies: 3
    Last Post: July 31st, 2011, 06:41 AM
  3. Mortgage Calculator Issue
    By coyboss in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 5th, 2011, 09:12 AM
  4. Replies: 1
    Last Post: May 3rd, 2010, 01:03 PM
  5. GPA calc code... HELP
    By ber1023 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 13th, 2009, 11:20 PM