Results 1 to 6 of 6
  1. #1
    jthamer is offline Member
    Join Date
    Nov 2015
    Posts
    2
    Rep Power
    0

    Default 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. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default 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
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

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

    Default 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.
    If you don't understand my response, don't ignore it, ask a question.

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

    Default 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. #5
    trcooke is offline Tim Cooke
    Join Date
    Jul 2014
    Location
    Belfast
    Posts
    101
    Rep Power
    0

    Default Re: calculate the cost of shopping


  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default 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
    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. shopping cart in jsp
    By vinci123 in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 01-11-2012, 05:08 AM
  2. Replies: 1
    Last Post: 04-27-2010, 11:29 PM
  3. Trying to calculate cost based on size
    By space4rent00 in forum New To Java
    Replies: 4
    Last Post: 03-22-2010, 07:13 AM
  4. Check difference between no. of stops, calculate cost
    By JavaStudent23 in forum New To Java
    Replies: 1
    Last Post: 11-14-2009, 04:03 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
  •