hey, how are u all doing? I am having problems with the StringTokenizer and I am hoping you all can help, I have a
test class that accepts the values of geometric figures in the following order (name of figure, side/radius, side 2, side 3) here is my test class and I want to know why its not working I am pretty sure its something wrong in my StringTokenization :
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import java.util.StringTokenizer;
class Driver
{
public static void main(
String[] arg)
{
String str = getData.getString("Enter data for a figure");
while(str != "")
{
StringTokenizer tok = new StringTokenizer(str);
while(tok.hasMoreTokens())
{
String figure = tok.nextToken();
double s1 = Double.parseDouble(tok.nextToken());
double s2 = Double.parseDouble(tok.nextToken());
double s3 = Double.parseDouble(tok.nextToken());
if(figure.equalsIgnoreCase("Triangle"));
Measurments b = new Triangle(s1,s2,s3);
System.out.println(s1 + '\t' + s2 +'\t' + s3 + '\t'
+ "-" + b.area() + b.perimeter() + "-" );
}
}
}
}