Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works

# Visual Logic

### #1 starrz Posted 04 May 2006 - 11:34 PM

starrz

Member

• Member
• 11 posts
I am working on a program for my Logic and Design class and I am having serious issues. I have to design a program that will tell a cashier what specific change to give back, i.e. 96 cents = 3 quarters, 2 dimes and a penny. I can seem to get it to work and I dont know where I am going wrong. This is my first week of the course and I am already stuck, please help. I can also be reached on Yahoo or AIM as starrswrld.
• 0

### #2 gust0208 Posted 05 May 2006 - 01:02 AM

gust0208

Member

• Member
• 311 posts
Problem solved, huzzah!

Cheers,
Tom

I am working on a program for my Logic and Design class and I am having serious issues. I have to design a program that will tell a cashier what specific change to give back, i.e. 96 cents = 3 quarters, 2 dimes and a penny. I can seem to get it to work and I dont know where I am going wrong. This is my first week of the course and I am already stuck, please help. I can also be reached on Yahoo or AIM as starrswrld.

• 0

### #3 ugadawgs Posted 06 May 2006 - 07:46 PM

ugadawgs

New Member

• Member
• 1 posts
I'm in the same situation as you are Starrz. If anyone knows how to write the mathematical equation out to make the program run right, please help. I can get the quarters to come out right, but I can't get the dimes, nickels, and pennies to come out right. Any help will be greatly appreciated.
• 0

### #4 gust0208 Posted 06 May 2006 - 08:04 PM

gust0208

Member

• Member
• 311 posts
Hey ugadawgs,

I can give the same help and code that starrz and I worked out together. You must be pretty close to the answer if you are getting the correct number of quarters, but then we have to subtract that amount from our total cents.

First step is caclulate number of given coin in the total amount of cents. We can do this with integer division.
Input cents
# of quarters = cents \ 25 (This will return the number of times 25 is in cents)

Now, we need to code the modulos operation (what is the remainder of cents divided by 25). We already know the number of quarters from above. So, we need to subtract that number times 25 from cents.
Remaining cents = cents - ( (cents \ 25) * 25))

Now, we simply repeat this for the remaining coin denominations (10,5).
# of dimes = Remaining cents \ 10
Remaining cents = Remaining cents - ( (Remaing cents \ 10) * 10))

Hopefully that helps and I have attached a working *.vls example of the problem.

Cheers,
Tom

I'm in the same situation as you are Starrz. If anyone knows how to write the mathematical equation out to make the program run right, please help. I can get the quarters to come out right, but I can't get the dimes, nickels, and pennies to come out right. Any help will be greatly appreciated.

• 0

### Similar Topics

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users