Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Math calculations

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Math calculations

    Hi!

    A friend of mine is trying to write a simulation of an ATM and can't seem to get it right.

    He want's it like so:
    If a user wants $100 and there are no $50 notes left, the machine gives them 5 $20 notes. Or if there are only 2 $50 note left in the machine and you want $150, it should dispence 2 x $50's, 2 $20's and 1 $10.
    Is there a way to account for this scenario?

    I dabbled in Java a few years ago but I tried to do this and have no idea.

    Does anyone know how to achieve this?

    Thanks in advance!


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Math calculations

    Have you thought through the steps a program must take to do what you are asking?
    Can you list the steps you have so far and ask any questions about the problems you are having in getting the logic for the program.
    I dabbled in Java a few years ago but I tried to do this and have no idea.
    So far this doesn't have anything to do with java. Its the design of a program to do a task.
    Once you have a design, then think about how to write it in a programming language.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 9
    Last Post: December 5th, 2012, 05:03 PM
  2. Replies: 3
    Last Post: November 8th, 2012, 01:24 PM
  3. User input and calculations problems
    By javabeg123 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 7th, 2011, 07:32 PM
  4. Confusion with Math.toDegrees() and Math.toRadians(). Please help.
    By marksquall in forum Java Theory & Questions
    Replies: 3
    Last Post: June 23rd, 2011, 01:28 AM
  5. Replies: 1
    Last Post: May 3rd, 2010, 01:03 PM