Results 1 to 6 of 6
Like Tree4Likes
  • 1 Post By Tolls
  • 1 Post By Norm
  • 1 Post By Norm
  • 1 Post By Tolls

Thread: How can I start the following project using Modular

  1. #1
    saeidj is offline Member
    Join Date
    Nov 2015
    Posts
    2
    Rep Power
    0

    Default How can I start the following project using Modular

    Hi everybody :)

    I want to start a project that reads in an integer representing the number of pennies and prints out the best way (i.e the fewest number of coins) to make change using British coins (50p, 20p, 10p, 5p, 2p and 1p only)1. For example, if the number of pennies entered is 73, then print out:
    1x50p
    1x20p
    1x2p
    1x1p

    if the entry was like 150,173 I could simply use modular. For instance 150%7= 3 which means 3 50p but as we talking about money the entry will be 1.50 or 2.73. Can somebody please tell me how I can use modular to solve this problem? I'm very new to java.
    Thanks
    Last edited by saeidj; 11-12-2015 at 04:07 PM.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    27

    Default Re: How can I start the following project using Modular

    Cross posted at Code Ranch.
    trcooke likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: How can I start the following project using Modular

    Convert the amounts to int values in pennies and work with that
    saeidj likes this.
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    saeidj is offline Member
    Join Date
    Nov 2015
    Posts
    2
    Rep Power
    0

    Default Re: How can I start the following project using Modular

    Quote Originally Posted by Norm View Post
    Convert the amounts to int values in pennies and work with that
    Thanks for your respond. could you please be more specific? how can I convert the amounts to int values in pennies? do you mean I have to add variables for each penny ? in this case for 1 penny it will be int penny1= 1; and I will have problem if I want to add 1 coin cause it will be the same won't it?
    Last edited by saeidj; 11-12-2015 at 06:34 PM.

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: How can I start the following project using Modular

    how can I convert the amounts to int values in pennies?
    For example a 1 coin is 100 pennies. (I'm American so that might not be correct. For the USA $1 is 100 pennies)
    saeidj likes this.
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    27

    Default Re: How can I start the following project using Modular

    Quote Originally Posted by Norm View Post
    For example a 1 coin is 100 pennies. (I'm American so that might not be correct. For the USA $1 is 100 pennies)
    It is correct.
    We've been decimalised for over 40 years...:)
    Gone are the days of farthings, shillings, and groats.
    saeidj likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. How is Java9 Modular?
    By pquiring in forum Advanced Java
    Replies: 2
    Last Post: 05-08-2015, 11:53 PM
  2. How to start build a project (using netbeans)
    By rothe in forum New To Java
    Replies: 6
    Last Post: 12-13-2013, 05:58 PM
  3. Best way to Start the Project
    By parvez in forum New To Java
    Replies: 4
    Last Post: 10-11-2012, 07:48 AM
  4. Replies: 4
    Last Post: 04-09-2012, 06:56 PM
  5. Modular Inverse Function issues.
    By christopherx in forum Advanced Java
    Replies: 0
    Last Post: 10-28-2011, 08:36 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
  •