# Thread: calculate the cost of shopping

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

## calculate the cost of shopping

hi guys ... am a new user in java ... how can you help me solve :

how can i make a program accepting the total cost from a customer and the amount he pays ... then the program says your change is 20 euro as Note and 3 euro as coins for example.
Last edited by jthamer; 11-23-2015 at 11:23 AM.

2. Senior Member
Join Date
Jan 2013
Location
Northern Virginia, United States
Posts
6,226
Rep Power
14

## Re: calculate the cost of shopping

how can you help me solve this assignment
By answering specific questions to problems you are having with your code. Since you said assignment I assume this is
for a class so you need to apply what you learned in class to solve the problem.

Regards,
Jim

3. ## Re: calculate the cost of shopping

could not fo it on Java
Post the code you are working on and the full text of any error messages here so someone can help you fix the problems.

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

## Re: calculate the cost of shopping

i could type the Scanner class and make the calculation. but i dont know to make the program says your change ,for example, 50 euro as note and 2 euro as coin. i. could did it saying yr change is 52 euro but this is not requested.

5. Tim Cooke
Join Date
Jul 2014
Location
Belfast
Posts
101
Rep Power
0

6. ## Re: calculate the cost of shopping

Also very interesting (at least imho), monetary systems (e.g. 1, 2, 5 or 1, 2.5, 5) are designed in a way, such that it you fit as many of the largest monetary unit in a certain amount and repeat the process until the sum equals the wanted sum, you have met the wanted amount with the minimum amount of bills/coins. Here's a counter example: assume an imaginary monetary system 1, 7, 9 and the amount 15; if you apply your algorithm here, you'll end up with 9, 1, 1, 1, 1, 1, 1 while the minimum amount of coins/bills is 7, 7, 1; so 1, 7, 9 makes a lousy monetary system.

kind regards,

Jos

#### Posting Permissions

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