Results 1 to 3 of 3

Thread: The change machine

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Posts
    2

    Unhappy The change machine

    The user enters the amount due and the amount tendered. You are to calculate how much change they should receive. You are then to break down the change in $1 bills, quarters, dimes, nickles, and pennies such that the user will receive the least amount of coins. For example $0.80 is 3 quarters and a nickel not 8 dimes or 80 pennies.

  2. #2
    Addicted Member Rudy's Avatar
    Join Date
    Sep 2000
    Location
    BC, Canada
    Posts
    198
    if no1 help u, tomorow ill help you, but right now its 2am and i want to sleep and i already did that program for school (i dont have the source anymore sorry man) and it's fairly easy, all u have to make sure is that your formula work. its a lot of math work and for some reasons the formula always end up ****ed lol that's why i want to wait for tomorow when my mind will be clear
    *Rudy^
    Visual Studio 6 Ent. SP5
    Windows 2000 SP4
    Windows XP SP1a

  3. #3
    Addicted Member
    Join Date
    Mar 2001
    Posts
    157
    You need to begin with the highest denomination and work down to the lowest, something like below.

    Amount=2.35

    dollars = (Amount mod 1)/1
    Amount = Amount mod 1

    quarters = (Amount mod .25)
    Amount = Amount mod .25

    ...
    ..

Posting Permissions

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



Click Here to Expand Forum to Full Width