Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Java programming help - Coins in a Jar

  1. #1
    Junior Member
    Join Date
    Apr 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java programming help - Coins in a Jar

    Hey there, I'm currently working on a computer science 40S course for high school. In the class, we are working with Java and Eclipse.. I have never taken any comp sci classes before this one, and have had no prior Java programming experience.

    One of the assignments asks to "Write an application that determines the number of coins in a jar and prints out the total in dollars and cents. Read integer values that represents the number of quarters, dimes, nickels and pennies. Use a currency formatter to print the output." I have went through the learning modules that the class has offered, and I have absolutely no idea where to start, or how this thing should look.

    Would anybody be able to help explain what I am to do, or possibly make an example to use as reference for future assignments, something that will help me grasp the understanding of how I should go about this class?

    Thanks in advance!


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Java programming help - Coins in a Jar

    Break the problem down - I would recommend translating the assignment into a step-by-step list of requirements (for instance, one step might be 'get values from user'). Once you know what is required you will be in a better position to translate this requirement into code.

  3. #3
    Junior Member drgy55's Avatar
    Join Date
    Mar 2014
    Posts
    7
    My Mood
    Mellow
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: Java programming help - Coins in a Jar

    I agree with copeg, but if you really have no idea where to start, break it down even further. You're trying to figure out the value in dollars and cents of the coins in the jar, right? Start simple, figure out the value in cents. You'll need separate integer variables for each type of coin that are equal to the value of that coin in cents. Then you'll need to specify (or have the user specify) how many of each coin there are in the jar. Add the coins up and you get the value in cents. So how would you print it out as dollars and cents? Well, as a hint, maybe try using the printf() method. If you haven't learned that, think about what kind of variable would use the same format as dollars and cents (i.e. a decimal point followed by two place values) and recognize that dollars=100*cents.

    Feel free to PM me if you want with any specific questions. The best way to go about any problem is to break it down into small pieces and solve it one step at a time. Good luck!

Similar Threads

  1. Tossing Coins for a Dollar Java Program?!?!
    By Judy_Ven in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 29th, 2014, 06:43 PM
  2. Linked Lists Java Programming HELPP P.S. I am a beginner in Java Programming
    By judemartin99 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 20th, 2013, 02:19 PM
  3. Trying to Give Coins For Change
    By bengregg in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 27th, 2011, 04:21 PM
  4. Java.jar and Mysql.jar
    By kurt-hardy in forum Java Theory & Questions
    Replies: 1
    Last Post: January 27th, 2011, 09:48 AM