I get the error that * operator is not defined but maths operators are supposed to be native, are they not? This program runs fine up until I try to multiply velocity by time to get distance.... In other simple calculator progs I've done none of the maths operators needed to be defined so WTF!??
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class strings {
/**
* @param args
*/
public static void main(String[] args) {
System.out.print("Enter velocity value in Mph and press Enter: ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String velocity = null;
try {
velocity = br.readLine();
} catch (IOException e) {
System.out.println("Error!");
System.exit(1);
}
System.out.println("velocity is " + velocity);
System.out.print("Enter time value in hours and press Enter: ");
BufferedReader br2 = new BufferedReader(new InputStreamReader(System.in));
String time = null;
try {
time = br.readLine();
} catch (IOException e) {
System.out.println("Error!");
System.exit(1);
}
System.out.println("time is " + time);
String distance = (velocity * time);
}
}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class strings {
/**
* @param args
*/
public static void main(String[] args) {
System.out.print("Enter velocity value in Mph and press Enter: ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String velocity = null;
try {
velocity = br.readLine();
} catch (IOException e) {
System.out.println("Error!");
System.exit(1);
}
System.out.println("velocity is " + velocity);
System.out.print("Enter time value in hours and press Enter: ");
BufferedReader br2 = new BufferedReader(new InputStreamReader(System.in));
String time = null;
try {
time = br.readLine();
} catch (IOException e) {
System.out.println("Error!");
System.exit(1);
}
System.out.println("time is " + time);
String distance = (velocity * time);
}
}

