i am trying to have macromedia flash button send a double or a symbol like (+, =, &) to a java program. the java program will save the input on an arraylist. while the flash button sends doubles it simply puts them on the arraylist, but if a symbol comes in, then the items from the arraylist are removed and summed up.
so this is the code that i have. i do not want to use the showOPtionPane dialog boxes from the java library. i want jave to simply be able to receive input.
import javax.swing.JOptionPane;
import java.lang.*;
import java.util.*;
import java.io.*;
public class arrayList
{
public static final String plus = "plus";
public static final double TAX = 0.08;
public static double subTotal = 0.00;
public static double total = 0.00;
public static void main(String[] args)
{
String price = ""; // initialized the variable price to empty string
ArrayList keypad = new ArrayList(); // create an arraylist and name it
// keypad
while (true) // continuous loop to stop when array is
// empty
{
try // read data from console
{
BufferedReader in =
new BufferedReader(new InputStreamReader(System.in));
//System.out.println("Enter price");
//System.out.flush();
price = in.readLine();
}
catch (IOException ioe) // if error then catch error
{
System.out.println(ioe);
}
keypad.add(price); // put data read from console into stack
if (price == ("+")) // if the data is a plus sign then add the items
// in the stack (subtotal key)
{
keypad.remove(price); //remove the + sign from the stack
for (int i = keypad.size() - 1; i <= 0; i--) // get all the data
// from the stack and continuously add them together
{
keypad.get(i); // get item from stack
subTotal += i; // add it to itself
keypad.remove(i); // remove item from stack
}
System.out.println("SubTotal is " + subTotal); // print subTotal
// to console
}
thx in advance.....