# New to this..so lost trying to learn...

• September 21st, 2010, 03:34 PM
ryan1234
New to this..so lost trying to learn...
I need the output to be look like this:
Enter the amount of the purchases: (user enters 44.28)
Enter the cash tendered: (user enters 50)

Your change is equal to 5.71999999999 which is...
5 dollars 72 cents
2 quarter (s)
2 dime(s)
0 nickel (s)
2 pennie (s)
-----------------------------------------------------------
As you can see the basic of the program is inform the user how much of each coin they get back with their change... if anyone can help me it would be a huge help!
Code java:

```package lab02;   / Purpose: Compute the amount of change a customer should receive (in terms of dollars, quarters, dimes, nickels, and pennies) given the amount of the purchase and the cash tendered.   @author jdoe   /   import java.util.Scanner;   public class Change {   /* @param args / public static void main(String[] args) { double purchaseAmt; double cashTendered; double totalChange; int dollars, cents;   // Create a Scanner object to read from standard input Scanner scan = new Scanner(System.in);   // Prompt the user and read in amount of purchase and // cash tendered. System.out.print("Enter the amount of the purchase: "); purchaseAmt = scan.nextDouble(); System.out.print("Enter the cash tendered: "); cashTendered = scan.nextDouble();   totalChange = cashTendered - purchaseAmt; dollars = (int) totalChange;   System.out.println(); System.out.println ("Your change is \$" totalChange " which is ..."); System.out.println(dollars + " dollars");   System.out.println();   }   }```
• September 21st, 2010, 03:57 PM
Norm
Re: New to this..so lost trying to learn...
Do you have the steps you need to take to solve your problem ie the alogrithm?
Do you have any specific problems or questions about writing the program?
• September 21st, 2010, 04:41 PM
Darryl.Burke
Re: New to this..so lost trying to learn...
Double posted here
http://www.javaprogrammingforums.com...ode-right.html

ryan1234 also started three threads with the same question at the Sun/Oracle forums. The threads have been removed and the user blocked for multiposting.

db
• September 21st, 2010, 05:12 PM
ryan1234
Re: New to this..so lost trying to learn...
I am getting blocked because i posted on two different forums is that a joke? thanks for the help.....
• September 21st, 2010, 05:18 PM
Norm
Re: New to this..so lost trying to learn...
It is annoying to those of us spending time answering questions to find out that the question has been answered and the time we spent working on the problem was wasted.
A simple addition of a link to the other forums where a question is posted would be considerate to those trying to help.
But posting three threads on one forum is a bit much.
• September 21st, 2010, 05:35 PM
copeg
Re: New to this..so lost trying to learn...
Please do not post the same question multiple times on the same forum. Your other post has been locked. Each forum has rules. Currently this forum allows posting the same question on other forums, however the reciprocal is not always the case. We do however, frown on posting the same question more than once, which is why your other post has been locked.

Now, to the post at hand, you should first read the rules on how to place comments within code: http://java.sun.com/docs/codeconv/ht...ions.doc4.html