Jump to content

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
Photo

Visual Logic


  • Please log in to reply

#1
starrz

starrz

    Member

  • Member
  • PipPip
  • 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

Advertisements


#2
gust0208

gust0208

    Member

  • Member
  • PipPipPip
  • 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

ugadawgs

    New Member

  • Member
  • Pip
  • 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

gust0208

    Member

  • Member
  • PipPipPip
  • 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.

Attached Files


  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP