Method and loop, beginners guide please!!

• 01-15-2009, 03:09 PM
soc86
Method and loop, beginners guide please!!
I am trying to complete this program for my HNC, i'am quite the novice, please help!! I'am trying to write a method and a loop, but i don't believe i'am doing this correct, any advise?

public static void main (String[]arg){

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

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

System.out.println("Enter anticipated income");

void main calculation() {

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);

}

while (newBal>0)

calculation
• 01-15-2009, 03:48 PM
angryboy
you can't have a method inside another method. and you have to wrap the whole thing in a class.
• 01-15-2009, 04:00 PM
soc86
Thank you!!!