944,118 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 9537
  • Java RSS
Jan 30th, 2005
0

Cash Register Application

Expand Post »
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)
Attached Files
File Type: java Exercise3_24.java (2.2 KB, 323 views)
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
bcheath_1 is offline Offline
20 posts
since Jan 2005
Jan 30th, 2005
0

Re: Cash Register Application

How come you prompt the user for amount in pennies?
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Jan 30th, 2005
0

Re: Cash Register Application

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.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
bcheath_1 is offline Offline
20 posts
since Jan 2005
Jan 31st, 2005
0

Re: Cash Register Application

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.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Feb 1st, 2005
0

Re: Cash Register Application

nested loops
Reputation Points: 10
Solved Threads: 0
Light Poster
Gink is offline Offline
46 posts
since Feb 2005
Feb 1st, 2005
0

Re: Cash Register Application

recursive function would be my choice. Far cleaner.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Sep 21st, 2005
0

Re: Cash Register Application

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
fiberoptik is offline Offline
7 posts
since Mar 2005
Sep 21st, 2005
0

Re: Cash Register Application

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
fiberoptik is offline Offline
7 posts
since Mar 2005
Sep 29th, 2005
0

Re: Cash Register Application

I tried working on this and this was my solution. Not very great maybe, i hope its of use to you
Attached Files
File Type: java assignment help.java (5.9 KB, 263 views)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cdpothen is offline Offline
1 posts
since Jul 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Why is sizeof operator notin Java
Next Thread in Java Forum Timeline: Help with Jtree





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC