Results 1 to 6 of 6
Thread: calculate the cost of shopping
 11222015, 11:28 PM #1Member
 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; 11232015 at 11:23 AM.
 11222015, 11:48 PM #2Senior 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
for a class so you need to apply what you learned in class to solve the problem.
Regards,
JimThe Java^{TM} Tutorials  SSCCE  Java Naming Conventions
Poor planning on your part does not constitute an emergency on my part
 11232015, 12:23 AM #3
Re: calculate the cost of shopping
could not fo it on JavaIf you don't understand my response, don't ignore it, ask a question.
 11232015, 08:34 AM #4Member
 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.
 11232015, 09:07 AM #5Tim Cooke
 Join Date
 Jul 2014
 Location
 Belfast
 Posts
 101
 Rep Power
 0
Re: calculate the cost of shopping
 11232015, 10:45 AM #6
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 14,422
 Blog Entries
 7
 Rep Power
 28
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,
JosBuild a wall around Donald Trump; I'll pay for it.
Similar Threads

shopping cart in jsp
By vinci123 in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 01112012, 05:08 AM 
Java application to calculate and display the cost of a number of tickets according
By herberwz in forum New To JavaReplies: 1Last Post: 04272010, 11:29 PM 
Trying to calculate cost based on size
By space4rent00 in forum New To JavaReplies: 4Last Post: 03222010, 07:13 AM 
Check difference between no. of stops, calculate cost
By JavaStudent23 in forum New To JavaReplies: 1Last Post: 11142009, 04:03 PM
Bookmarks