Results 1 to 2 of 2

Thread: looop help

  1. #1
    soc86 is offline Member
    Join Date
    Oct 2008
    Posts
    39
    Rep Power
    0

    Default looop help

    Any advise on what is wrong with my loop please?

    public static void main (String[]arg){

    double loan;
    double wages;
    final int THRESHOLD= 10000;
    double netInc;
    double newBal=0;
    double totalLoan;
    double deduction;


    System.out.println("Enter total amount of student loan taken");
    loan=UserInput.readDouble();

    System.out.println("Enter anticipated income");
    wages=UserInput.readDouble();

    newBal=loan*0.03;

    netInc=wages-THRESHOLD;
    deduction=netInc*0.09;

    totalLoan=loan+newBal;

    newBal=totalLoan-deduction;




    System.out.println("Loan taken out: "+loan+" anticipated income "+wages);
    System.out.println("Total plus interest: "+totalLoan);
    System.out.println("Amount Re-paid: "+ deduction);
    System.out.println("New balance: "+newBal);


    }
    public static calculate(double amount)
    {


    while(newBal >0.0){


    newBal=loan*0.03;

    netInc=wages-THRESHOLD;
    deduction=netInc*0.09;

    totalLoan=loan+newBal;

    newBal=totalLoan-deduction;

    System.out.println("Loan taken out: "+loan+" anticipated income "+wages);
    System.out.println("Total plus interest: "+totalLoan);
    System.out.println("Amount Re-paid: "+ deduction);
    System.out.println("New balance: "+newBal);
    }

    else {

    System.out.println("end ");

    }

    }




    }//end main

    }//end class

  2. #2
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default Don't do that

    Do not post multiple times the same question on the forum. Stay with only one post for the same subject.

    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

Posting Permissions

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