Results 1 to 5 of 5
Like Tree5Likes
  • 4 Post By sabre150
  • 1 Post By Fubarable

Thread: A program that give change

  1. #1
    Nixter1997 is offline Member
    Join Date
    Aug 2012
    Posts
    15
    Rep Power
    0

    Angry A program that give change

    For the last part of my project i need a small piece of coding to give change.

    For example the change is $44.50
    I WANT IT TO DISPLAY

    20 notes x :2 // 20x2=40
    10 notes x :0
    5 notes x :0
    2 coins x :2 // 2x2 = 4
    1 coins x :0
    50c coins x :1 // 50x1= 50

    //Ans=$44.50

  2. #2
    sabre150 is offline Member
    Join Date
    Jul 2012
    Location
    Earth
    Posts
    75
    Rep Power
    0

    Default Re: A program that give change

    I don't want to learn Java either. When somebody feeds you this code can I plagiarise it and use it for my homework?

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: A program that give change

    Quote Originally Posted by Nixter1997 View Post
    For the last part of my project i need a small piece of coding to give change.
    You'll be much more likely to get good help and to learn more if you show us what you've tried and ask specific questions about exactly what it is you don't understand.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: A program that give change

    Quote Originally Posted by sabre150 View Post
    I don't want to learn Java either. When somebody feeds you this code can I plagiarise it and use it for my homework?
    ha ha ha. My sarcasm detector just blew a gasket on this one.
    quad64bit likes this.

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,570
    Blog Entries
    7
    Rep Power
    21

    Default Re: A program that give change

    Almost nobody realizes it but there is something 'special' about those monetary systems, e.g. the popular change algorithm (unknow to the OP) doesn't result in a minimum amount of notes and/or coins in every system; e.g. the system 1, 5, 7 doesn't give an optimal solution for, say, 10 (7+1+1+1, while 5+5 is a better solution). Maybe I should ask for a formal proof of this 'special' property in the old 'quiz' topic ;-)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Replies: 12
    Last Post: 04-20-2012, 05:43 PM
  2. Replies: 1
    Last Post: 08-13-2010, 08:13 AM
  3. Replies: 1
    Last Post: 07-07-2010, 09:25 AM
  4. [Help] Change to give back program
    By Duranx in forum New To Java
    Replies: 5
    Last Post: 02-06-2010, 03:52 AM
  5. Replies: 6
    Last Post: 12-17-2008, 03:37 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
  •