But how does this algorithm determine the number of ways? doesnt it just determine the least amount of coins needed? shouldnt the algorithm be
Number of ways to change amount A using N kinds of coins =
Number of ways to change amount A using all but the first
kind of coin
+
Number of ways to change amount A - D using all N kinds
of coins, where D is the denomination...
User Profile
Collapse
-
counting change algorithm
I need to write a recursive program to count the number of ways to make change from a given number of cents using quarters, dimes, and nickles. I cant figure out what the algorithm is - do you have any advice for me??? -
keyboard events
How can i make it so that when a user presses control-S an object is painted in a frame? How can I combine the two key events?? -
linking frames
Hi I need to create two frames in java. One that is a color palette and one that you can load an image into. Then when you click on one of the colors in the color palette frame, you have to be able to draw in that color in the other frame. How can I link these two frames so that the color can be used for drawing???
thanks -
I am haviing trouble parsing the body of the message. This is my code. it doesnt give me any errors but when I try to run it and print it to the screen nothing prints HELP!!!!
...Code:boolean messageStarted = false; if(line.indexOf("Message Body:") != -1) { Scanner scan = new Scanner (line); scan.useDelimiter(Pattern.compile("[<>]"));Leave a comment:
-
parsing emails in java
I have to parse an email message by separating the "To", "From", "Subject" and body of the text in order to then use this for a spam filter. I am having a difficult time figuring out how to parse the messages any suggestions??? -
you have to give the least amount of 10 dollar bills, 5 dollar bills, one dollar bills, quarters, nickels, dimes, and pennies not just coinsLeave a comment:
-
...Code:i mport java.util.Scanner; import java.text.NumberFormat; import java.util.Locale; public class Money3 { public static void main(String args[]) { NumberFormat fmt = NumberFormat.getCurrencyInstance (Locale.US); Scanner input = new Scanner(System.in);Leave a comment:
-
monetary amounts in java
I have to write a program to prompt for a monetary amount from a user and then change that amount into 10 dollar bills, 5 dollar bills, one dollar bills, quarters, dimes, nickels, and pennies.
I wrote the program but sometimes it is one penny off. I have read some previous discussions about this which told me to use the BigDecimal class or swing classes but i havent learned about those yet in my class.I was wondering if there are any simpler...
No activity results to display
Show More
Leave a comment: