Your reponse is appreciated however it may be difficult to implement
with the dollar value being a String which contains a "$" and a comma to
delineate thousands in its initial form in the database.
How does one efficiently convert the Strings to int or floats for division.
String price = "$1,000";
int salePrice = 0;
// to int i from String g try {
salePrice = Integer.parseInt(price.trim());
} catch (NumberFormatException e){}
fails
also;
// to int i from String g try {
salePrice = Float.parseFloat(price.trim());
} catch (NumberFormatException e){}
also fails due to dollar sign and comma contained in the string.
Is there an API library with the magic to convert the string format in
the database to a useful math ready state. Maybe something in the
locale or math classes
Thomas said:
Hello All,
I wish to do manipulations such as
$10.00/$12.00 = answer
Any comments, code suggestions or offerings are appreciated.
Steve
public class GetAnswer
{
public static void main(String args[])
{
int a = 10;
int b = 12;
int answer = a/b;
System.out.println("New amount = $" + answer);
}
}
Or did I not understand your question correctly?
Thomas