Need help with a loop statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hjc
    New Member
    • Oct 2006
    • 14

    Need help with a loop statement

    I am trying to write a program that will give me the number of coins it takes to make up a particular amout. if I write 50 in the command prompt it will say 2 quarters. I have this much and need help with the while loop

    class coin{
    static int amount;

    public static void main(String[] args){
    amount = Integer.parseIn t(args[0]);

    System.out.prin tln("Quarters "+ computeCoin(25) );
    System.out.prin tln("Dimes "+ computeCoin(10) );
    System.out.prin tln("Nickles "+ computeCoin(5)) ;
    System.out.prin tln("Pennies "+ computeCoin(1)) ;
    }

    public static int computeCoin(int quarters){
    quarters = 25;
    return amount;
    }
    }
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by hjc
    I am trying to write a program that will give me the number of coins it takes to make up a particular amout. if I write 50 in the command prompt it will say 2 quarters. I have this much and need help with the while loop

    class coin{
    static int amount;

    public static void main(String[] args){
    amount = Integer.parseIn t(args[0]);

    System.out.prin tln("Quarters "+ computeCoin(25) );
    System.out.prin tln("Dimes "+ computeCoin(10) );
    System.out.prin tln("Nickles "+ computeCoin(5)) ;
    System.out.prin tln("Pennies "+ computeCoin(1)) ;
    }

    public static int computeCoin(int quarters){
    quarters = 25;
    return amount;
    }
    }
    You should continue this in it's original thread and continue the problem from where you left it off there. You probably get the same suggestions here that you got in the first thread for this problem.

    Comment

    Working...