Results 1 to 7 of 7
  1. #1
    HbJgd's Avatar
    HbJgd is offline Member
    Join Date
    Mar 2011
    Location
    Doesn't matter
    Posts
    10
    Rep Power
    0

    Exclamation Change Maker Startoff - Challenging

    So my teacher decided to challenge us and gave us 1 week to make a graphical change maker. Basically what it will do is you will enter an amount to be paid, for example "$17.29".. and then you will enter an amount to pay with, for example "20.00"..
    his requirements are a button for each of the types of bills "1,5,10,20,50,100" and coins "penny, nickel, dime, etc..", and then when you select a bill and coins to pay with, a picture of that bill and/or coin will pop up, and you can also be able to pay with more than one bill an or coin like "2 5's, 4 1's" and 3 quarters, and each time you press it the corresponding bill/coin will appear.. then there will be a confirm/pay button you hit to make the transaction.. and it will then say in a window box at the bottom saying "thank you for paying, your change is: x"... and when the change comes out it will have a picture of each bill/coin used to make the change..
    Im baffled on how to approach this problem.. shoulda i use separate classes for each type of currency or should i use it all in one long class?
    any help would be appreciated..

    Thanks,
    HbJgd

  2. #2
    doWhile is online now Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default

    Im baffled on how to approach this problem.. shoulda i use separate classes for each type of currency or should i use it all in one long class?
    You can implement it however you wish (as long as it works as expected ;) ) . My advice would be to break the problem up...for example you need a GUI and an algorithm - break those elements up and work on each, in turn breaking each up further if needed. Trying to tackle it all at once can be overwhelming, and result in code that looks like spaghetti (aka code that is hard to debug and maintain).

  3. #3
    HbJgd's Avatar
    HbJgd is offline Member
    Join Date
    Mar 2011
    Location
    Doesn't matter
    Posts
    10
    Rep Power
    0

    Default

    alright.. im thinking that making them all separate classes would be very inefficent because i would end up with 10+ different object classes.. but it could be much easier to code.. decisions decisions..

  4. #4
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Simpler to manipulate is almost always better. You can have 1 file with multiple classes if you want. The only real problem is that a currency type is generally constant so they should be designed a bit differently. (People should not be able to use constructors to change values) Show some code of the beginning, for now don't bother with the gui. Work on the classes and design the algorithms to work on the console.

    Do some work, figure out as much as you can and then post code here when you get stuck and we can help you out.

    Below is a basic outline of a 1 dollar bill to get you started
    Java Code:
    class OneDollarBill{
      //instance variables(value, image possibly?)
      //private constructor
      
      //static factory to get an instance
      
      //getters
    
      //setters are not needed(the image and value...or other instance variables, should not be able to be changed.)
    }
    I gave you some things to use, and didn't design the exact methods and such for you but this is just a basic example to get your started.
    Last edited by sunde887; 03-10-2011 at 03:32 AM.

  5. #5
    HbJgd's Avatar
    HbJgd is offline Member
    Join Date
    Mar 2011
    Location
    Doesn't matter
    Posts
    10
    Rep Power
    0

    Default

    alright thanks.. im still in the planning stage.. im probably going to have 1 file with all the types of currency like you said, then make another file to actually do the change making.. the GUI is always the last thing i worry about, because it's my weakest point..

  6. #6
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Ya, GUI's thankfully aren't that challenging, just a bit time consuming. If you get stuck or want guidance/advice on your code progress feel free to ask.

    It's generally beneficial to break your project into lots of small parts that work together than have one massive gelatinous blob of code.

  7. #7
    HbJgd's Avatar
    HbJgd is offline Member
    Join Date
    Mar 2011
    Location
    Doesn't matter
    Posts
    10
    Rep Power
    0

    Default

    haha true.. im going to step by step but once i get the first currency object done it should be a cake walk.. and yeah ill keep you in mind if i have questions/unknown errors..

Similar Threads

  1. UML maker using SWT
    By Ramandeep in forum SWT / JFace
    Replies: 0
    Last Post: 03-09-2011, 11:35 AM
  2. Challenging error
    By diwakardelhi in forum AWT / Swing
    Replies: 2
    Last Post: 11-15-2009, 09:40 PM
  3. Replies: 4
    Last Post: 08-28-2009, 06:50 PM
  4. challenging problems
    By jayant3001 in forum JCreator
    Replies: 24
    Last Post: 10-30-2008, 05:41 AM
  5. java api for reading adobe frame maker files
    By venkatmatcha in forum Advanced Java
    Replies: 2
    Last Post: 06-30-2008, 06:00 AM

Posting Permissions

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