Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8667485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:58:28+00:00 2026-06-12T17:58:28+00:00

Was given the below excercise in college but can’t get my head around the

  • 0

Was given the below excercise in college but can’t get my head around the last bit. How do you brake the answer down to notes. what if the answer can’t be devided by 50 etc…
I’ve tried modulus & Math class….

Mr Cashman, the owner of the local corner shop is having trouble with
his staff giving the wrong change. To tackle this he has commisioned
you to create a program that allows the staff member to enter the
total cost of the shopping and the amount the customer has paid. The
program should then calculate and output how many €50, €20, €10, €5
notes, and how many €2, and €1 coins to give the customer as change.
Mr. Cashman refuses to deal with small coins so although the staff
member enters a decimal value for the cost of the shopping he rounds
all of his prices down to the nearest euro and doesn’t bother with
50c, 20c, 10c, 5c, 2c or 1c coins.

Write, compile and test the application as per Mr Cashmans
requirements and save the class as MakingChange.java

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:58:29+00:00Added an answer on June 12, 2026 at 5:58 pm

    You have the right approach with modulo, but integer division is needed as well. Let’s examine the value €164.

    If you divide 164 by 50 (with integer division), you get 3. So that’s 3 €50 notes needed.

    If you work out 164 modulo 50, you end up with 14, the value left after you’ve taken out those three €50 notes. That’s you starting point for the next iteration with €20 notes.

    Then you just keep doing it until you’ve exhausted all the currency types.

    In other words, the pseudo-code could look something like:

    def workOutNotes (numEuros):
        left = numEuros
        //                               for 164:      numXXs   left
        num50s = int (left / 50); left = left % 50; //      3     14
        num20s = int (left / 20); left = left % 20; //      0     14
        num10s = int (left / 10); left = left % 10; //      1      4
        num5s  = int (left /  5); left = left %  5; //      0      4
        num2s  = int (left /  2); left = left %  2; //      2      0
        num1s  = left;                              //      0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given below is the simplest script I put together to test XMLHttpRequest. But, no
Code given below is taken from the stackoverflow.com !!! Can anyone tell me how
The code given below shows a Stackoverflow error when run.But if I make another
Given below is program for encrypting a string. I had taken this code from
for the Given below code after int Input Value of 46348 i am getting
In the code given below, I need to position the userid box in the
In the code given below, I am trying to modify it in such a
I have a string.An example is given below. [playlist]\r\npath1=url1\r\npath2=url2\r\npath=url3\r\npath4=url4\r\ncount=1 How can I extract path
My JqGrid code is as given below $('#grid').jqGrid({ url: '', scroll: 1, postData: {
Hello friends i am running code given below which contains the setLogTimeEntery function and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.