I just have a question about adding some currency ($) in JAVA, I used the NumberFormat.getCurrencyInstance(); to get my outputs in "$". My program is to input some money (String format) for example the program only accepts ($100.00, $50.00, $20.00 ... and so on) so I used this code:
String payment = keyboard.next();
while (!(payment.equals("$100.00")) && (!payment.equals("$50.00")) && (!payment.equals("$20.00")) && (!payment.equals("$10.00")) && (!payment.equals("$5.00")) && (!payment.equals("$2.00")) && (!payment.equals("$1.00")) {
System.out.print("Invalid coin or note. Try again. ");
payment = keyboard.next(); }
How can I get the inputs (100.00, 50.00 ... ) as a Double in order to subtract them from the total price.. for example I want (100.00-12.00) (12.00 is the total price)
Any help would be appreciated Thanks