954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Cash Register Application

I have attached my current source code to this message. It is in .java format.

Here is a brief description of my problem:

I have a program which accepts input for a Purchase Price, an Amount Tendered, and then displays the Change Due. Also, it must display the number of dollars, quarters, dimes, nickels, and pennies. The input is complete and I can calculate the Change Due, but I cannot figure out how to calculate each piece of change individually.

Note: The output is not in the code, but I know how to properly write it, so I won't need any help with output

Thanks in advance for any help:


Also, here is the look my application is to have:

Purchase Price: $ ________ (completed)
Amount Tendered: $ ________ (completed)

Your change is: $ ________ (completed)

__ one dollar bill (s)
__ quarter (s)
__ dimes (s)
__ nickel (s)
__ penn (y/ies)


Thank you for your business. Come back soon. (completed)

Attachments Exercise3_24.java (2.24KB)
bcheath_1
Newbie Poster
20 posts since Jan 2005
Reputation Points: 10
Solved Threads: 1
 

How come you prompt the user for amount in pennies?

server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
 

Well as you can see in the problem message in the source code, it is required. This is a homework assignment, so I have to do what the instructor says. I hope that explanation helps.

bcheath_1
Newbie Poster
20 posts since Jan 2005
Reputation Points: 10
Solved Threads: 1
 

So all you need to do is find out how to most efficiently give change?

How do you determine what combination of coins and bills to use in a store? All you have to do is put that reasoning into code.

Say you give $1.26 in change.
How many dollars is that?
When those are gone, how many quarters are there in the leftover amount?
etc. etc. etc.

It's not hard.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

nested loops

Gink
Light Poster
46 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
 

recursive function would be my choice. Far cleaner.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

I have to do the same basic problem. My prof. said to use integer division & modulus to find the amount for each coin in nested if loops. How to write it is the next big headache.

fiberoptik
Newbie Poster
7 posts since Mar 2005
Reputation Points: 10
Solved Threads: 0
 

I have to do the same basic problem. My prof. said to use integer division & modulus to find the amount for each coin in nested if loops. How to write it is the next big headache.We're to specify if the coin is singular/plural also.

fiberoptik
Newbie Poster
7 posts since Mar 2005
Reputation Points: 10
Solved Threads: 0
 

I tried working on this and this was my solution. Not very great maybe, i hope its of use to you

Attachments assignment_help.java (5.88KB)
cdpothen
Newbie Poster
1 post since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You