C#. Change Counter up to $1

Posted 17 February 2013 - 10:20 PM

I having an extra credit homework assignment, and I've been stuck for hours trying to find a way to display amount of changed enter. There are 4 field. Nickles, Quarters, Dimes, and Pennies. But I'm having trouble with the user input and and calculation.

Here we are taking the value from our textbox and parsing it into a double value called "result". This variable is now a double so we can divide it by .25 and that will tell us the number of quarters fit into the result.

So play with the ideas here and you will be on the right track. (Hint: think about the modulus operator % to get a remainder of money that didn't fit evenly into quarters. This amount will then go to finding dimes, nickles and pennies)

Here we are taking the value from our textbox and parsing it into a double value called "result". This variable is now a double so we can divide it by .25 and that will tell us the number of quarters fit into the result.

So play with the ideas here and you will be on the right track. (Hint: think about the modulus operator % to get a remainder of money that didn't fit evenly into quarters. This amount will then go to finding dimes, nickles and pennies)

Re: C#. Change Counter up to $1

I'm with Michael on this. You're in over your head. You've missed some vital bits and need to back up a chapter or 3 and go over the material again until it makes sense.

"I don't know where to start" - This usually means you should go back to your instructor and admit you are this lost. Don't bluff your way through this course thinking that by chapter 10 it will all suddenly snap into place and become clear. It won't. Unlike history class where chapter 1 might be 17th century England and chapter 2 might be World War II, giving you a fresh start - Coding builds upon the lessons of the previous chapter. You have to use lesson 1 material to succeed in lesson 2. Chapter 10 builds upon and uses material from chapter 9. If you let your pride get in the way you will be too lost to recover and have wasted thousands of dollars in tuition.