Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am trying to figure out how to use java 4 my class... our assignment is to learn java and figure out how to do some type of mathematical equation in the application... i decided to do currency. I have tried to read up on java but i cant find really any good sources to get started. Any one willing to help or give me some sites that i could use to understand this stuff. if it helps i am using notepad and html to run it.
Thanks

A very good place to start is Sun's Java Tutorial at
http://java.sun.com/docs/books/tutorial/index.html

In particular, check out the NumberFormat class...
http://java.sun.com/j2se/1.4.2/docs/api/java/text/NumberFormat.html

that site didnt help very much after all i guess i have no clue when it comes to java so i am just going to ask what to do.
Here is what i have:
<form name=currencycounter>
Enter the U.S. dollar amount here:<input type=text name=dollar size=6>
<input type=button value="Yen"
<input type=button value="Pound"
<input type=button value="franc"i am trying to make it when you enter the number in american currency into the box it then hit a one of the buttons to convert it into the other currency it will return the results. what should i do from here?

Ok, I see what you're doing. The NumberFormat class will only parse strings and format numbers. You will need to do the conversion yourself. Heres a site I found that has the conversion rates...
http://www.angus.co.uk/haggis/currconv.html
Use this to parse the number the user inputs..
Number myNumber = NumberFormat.getCurrencyInstance(Locale.US).parse("$123.45");
and then from there you can do the conversion and print it back to the user.

<html>
<head>
The Currency Counter
<title>
The Currency Counter
</title>
</head><body>
<script language = "Javascript">
var Yen = 0.00921;var Pound = 1.788
var Franc = 0.7714
</script><form name = "currency counter">
Enter the U.S. dollar amount here:
<input type=text name=dollar size=6>
<input type=button value="Yen">
<input type=button value="Pound">
<input type=button value="Franc">
</form>
</body>
</html>//Goals:;
//user type in dollar amount and translate it into the other currency.;
//if the user puts in somthing that is not valid have it say it is not a valid number.;
Here is what i have now i am not sure how to plug in that suggestion. i was thinking it might have something to do with onclick but then i am lost

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |