# Thread: How can I start the following project using Modular

1. Member
Join Date
Nov 2015
Posts
2
Rep Power
0

## 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. Moderator
Join Date
Apr 2009
Posts
13,541
Rep Power
27

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

Cross posted at Code Ranch.

3. ## Re: How can I start the following project using Modular

Convert the amounts to int values in pennies and work with that

4. Member
Join Date
Nov 2015
Posts
2
Rep Power
0

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

Originally Posted by Norm
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. ## 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)

6. Moderator
Join Date
Apr 2009
Posts
13,541
Rep Power
27

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

Originally Posted by Norm
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.

#### Posting Permissions

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