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

    Unhappy 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");
    loan=UserInput.readDouble();

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

    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

  2. #2
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    you can't have a method inside another method. and you have to wrap the whole thing in a class.

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

Similar Threads

  1. Creating a New Method for Square Root Loop
    By SapphireSpark in forum New To Java
    Replies: 14
    Last Post: 02-25-2009, 01:21 PM
  2. Help with beginners program
    By DanK in forum New To Java
    Replies: 6
    Last Post: 12-15-2008, 05:02 AM
  3. Replies: 3
    Last Post: 10-23-2008, 05:11 AM
  4. what is d best spring book 4 beginners
    By shikhin_82@yahoo.co.in in forum Web Frameworks
    Replies: 3
    Last Post: 10-17-2008, 04:12 PM
  5. Replies: 4
    Last Post: 09-05-2008, 04:47 PM

Posting Permissions

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