Some one please Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • paj171
    New Member
    • Nov 2007
    • 1

    Some one please Help

    I have a assignment and I cant figure out why the payment value cannot be resolved.. Can anyone help?

    import java.util.*;

    public class HW8 {
    public static double payment(double amnt, double intrate, int mths){
    double mnthpymnt;
    mnthpymnt= amnt*((intrate) *(Math.pow((1+i ntrate),mths))/(Math.pow((1+in trate),mths)-1));

    return payment;
    }
    public static double balance2(double balance, double intrate, double mnthpymnt ){
    double pramnt, intamnt, endbal;
    intamnt= intrate*balance ;
    pramnt=mnthpymn t-intamnt;
    endbal= balance-pramnt;

    System.out.prin tf("The interest is $%.2f and the principle is $%.2f %n", intamnt, pramnt);
    return endbal;}
    public static void main ( String[]args){
    Scanner hw=new Scanner(System. in);
    int index;
    double mnthamnt, endbal;
    System.out.prin tln("What is the amount of the loan?");
    double amnt= hw.nextDouble() ;
    System.out.prin tln("What is the interst rate?");
    double intrate=hw.next Double();
    System.out.prin tln("What is the yearly loan period?");
    int mths=hw.nextInt ();
    System.out.prin tf("The amount of the loan is $%.2f%n", amnt);
    System.out.prin tf("The interest percentage on the loan is %.1f %n", intrate);
    mths=mths*12;
    System.out.prin tf("The duration of the loan in years is %n", mths);

    intrate=(.01*in trate)/12;
    mnthamnt= payment(amnt,in trate, mths);
    System.out.prin tf("The monthly payment is $%.2f %n", mnthamnt);
    endbal= amnt;
    for(index=0; index<mths; index= index+1)
    endbal=balance2 (endbal,intrate ,mnthamnt);}



    }
Working...