Results 1 to 5 of 5
  1. #1
    random0munky is offline Member
    Join Date
    Oct 2008
    Location
    Washington, US
    Posts
    28
    Rep Power
    0

    Default Really Stuck on how to Start this program

    Okay, I know I should be posting some code here and showing where I've started and such, but I'm pretty lost as to how to start this program. Here's the problem:

    2. Making Change:

    This application, named ChangeMaker, will take as input a product price and an amount paid,
    both floating-point numbers representing euro and cent amounts. The application computes and prints the amount of change due the user, and also expresses the change amount in number of 2-euros, 1-euro, 20-cent, 10-cent, 5-cent, 2-cent, and1-cent coins.

    (Assume no change is given in bills, only in coins.)

    For example:
    Enter product price: 2.32
    Enter amount paid: 5.00
    Your change is 2.68 euros
    1 x 2 euro
    3 x 20-cent
    1 x 5 cent
    1 x 2 cent
    1 x 1 cent

    You can assume that the amount paid is greater than the product price, and that both inputs are
    "euro and cent" amounts: positive numbers with at most two decimal places.3

    Now, I know how to print the line asking for product price and enter amount paid, but I cannot figure out how to set up the rest of the code when switching from american USD dollars/coins to euros. I looked up the conversions and they are just intimidating as all get out when trying to take the equivalency of euros to each dollar thats entered and then taking the rest of the USD remainders and represent that in USD coinage. >.< Help is much appreciated thank you.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    1. Open your text editor.
    2. Type some code.
    3. Save the code in a File that has the same name as the public class defined in the code and that ends with ".java"
    4. Compile that code with "javac"
    5. Read the compiler messages.
    6. Fix the errors.
    7. Save again.
    8. Repeat steps 4 through 7 until it compiles.
    9. Run the code.
    10. Evaluate the cause of any exceptions.
    11. Fix the code.
    12. repeat steps 4 though 11 until the program runs without error.

    Now, when you have a specific question that pertains the code that you have written, then come back here, post that code, and ask that question, but we are not going to do it for you.

    As a hint: Find the difference, then figure out the amounts of the various denominations by using divide and modulus (starting with the largest denomination) on that difference.

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,899
    Rep Power
    25

    Default

    Break the program up into several small parts and program separately, then merge them as you learn the tecniques.
    1) Hardcode the price and amt entered and compute the change.
    2) Break an amount up into its 100s, 10s, and units - Hint use division.
    3) Change the above to break an amount up into different bill, coin values: bills =100, 50, 20, 10 5, 1 coins= 20, 10, 5, 1

    4)Add code to get the input from the user

  4. #4
    random0munky is offline Member
    Join Date
    Oct 2008
    Location
    Washington, US
    Posts
    28
    Rep Power
    0

    Default

    Awesome thank you so much for the hints everyone to start this program. I'm going to see what I can do without banging my head to much on this stupid monitor screen >.< bleh!! I'll let you know with what I can come up with.

  5. #5
    random0munky is offline Member
    Join Date
    Oct 2008
    Location
    Washington, US
    Posts
    28
    Rep Power
    0

    Default

    Well I finally figured it out with lots of help from other students in the class. It was much easier than it appeared to be. Thanks for the hints everyone much appreciated ^^ :D

Similar Threads

  1. stuck on an assignment
    By starchildren3317 in forum New To Java
    Replies: 11
    Last Post: 11-20-2008, 12:03 AM
  2. Stuck in need of help!
    By Zombie_Leg! in forum New To Java
    Replies: 1
    Last Post: 09-23-2008, 03:22 AM
  3. Replies: 8
    Last Post: 08-26-2008, 05:50 AM
  4. musically stuck
    By geork in forum New To Java
    Replies: 1
    Last Post: 02-06-2008, 10:44 PM
  5. FireSimulation Program, got stuck with a bug...
    By riz618 in forum New To Java
    Replies: 5
    Last Post: 01-28-2008, 04:48 PM

Posting Permissions

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