Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account

# 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

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

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