Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By Junky

Thread: Newbie BlueJ Bank task help with withdrawals

  1. #1
    sim18 is offline Member
    Join Date
    Oct 2011
    Posts
    30
    Rep Power
    0

    Default Newbie BlueJ Bank task help with withdrawals

    Hi guys, new to Java

    If somebody at a bank did a withdrawal, and were going to be charged at 5% of the total amount, can anybody say how to do this

    //
    public int calculateFee(int amount)
    {
    return 5 % amount;
    }
    //

    Thats what I have got so far, and I know it is definatly not right!

    How do you do percentages?

    Thanks

  2. #2
    tnrh1 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    251
    Rep Power
    3

    Default Re: Newbie BlueJ Bank task help with withdrawals

    If somebody at a bank did a withdrawal, and were going to be charged at 5% of the total amount, can anybody say how to do this
    I guess a first grade student would solve it.

    "%" means module.
    There is no a percentages sign in java.
    Use double and not int, to divide use "/" and to multiply use "*" I hope things are more clear now.

  3. #3
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default Re: Newbie BlueJ Bank task help with withdrawals

    I think you mean modulus. Or is it modulo? Baah just use mod and people know what you mean.
    Last edited by Junky; 10-31-2011 at 11:30 PM.
    tnrh1 likes this.

Similar Threads

  1. help java bank....
    By natsuki in forum Introductions
    Replies: 2
    Last Post: 07-25-2011, 03:36 AM
  2. Help with a Bank graphic simulation
    By JaEdmuva in forum AWT / Swing
    Replies: 1
    Last Post: 01-11-2011, 08:19 AM
  3. Bank Account
    By HPcompaq256 in forum New To Java
    Replies: 11
    Last Post: 02-26-2010, 09:05 PM
  4. Code bank
    By Eranga in forum Suggestions & Feedback
    Replies: 2
    Last Post: 01-01-2008, 05:23 AM
  5. Help MEEEEEEE! bank project
    By subwoofer717 in forum Advanced Java
    Replies: 1
    Last Post: 12-25-2007, 09:08 AM

Posting Permissions

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