How do I create a currency converter in java?
I am taking my first computer class and we are working with java. I still do not fully understand it, but I am supposed to creat a currency converter from US$ to Canadian$. I was wondering if anyone could help me out
Public Comments
- Something like this. I found the conversion amount at this location http://www.google.com/#hl=en&source=hp&fkt=1151&fsdt=2995&q=1+us+dollar+to+canadian+dollar You may need tochange the program to get the current value by visiting the above url. import java.util.*; public class Help50 { public static void main(String a[]) { double usDollarAmount,canadianDollarAmount; System.out.print("Enter the amount in US Dollars :"); Scanner sc = new Scanner(System.in); usDollarAmount = sc.nextDouble(); canadianDollarAmount = 1.05909989 * usDollarAmount; System.out.println(usDollarAmount + " U.S. Dollars = " + canadianDollarAmount + " Canadian Dollars"); } }
Powered by Yahoo! Answers