My code:
import java.io.*;
public class compute_volume
{
public static void main(String args[])throws IOException{
InputStreamReader reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(reader);
boolean answer;
double radius,height;
final double pi = 3.14159;
do{System.out.println("Enter the radius,press enter and then enter the height");
String t = input.readLine();
radius = Integer.parseInt(t);
t = input.readLine();
height = Integer.parseInt(t);
System.out.println("The volume of a cylinder with radius " + radius + " and height " + height + " is " + (pi*pi*height) + "\n Thanks for using my cylinder volume calculator.Enter \"yes\" to use again or \"no\" to stop.");
t = input.readLine();
System.out.println(t);
if ( t == "yes"){
answer = true;
}else{
answer= false;
}
}while(answer);
}
}
Problem:
The user inputs yes
but the calculator doesn't restart.
Solution:
That's what I don't know ,and hope to know by posting this here.