Hello, I started learning java two days ago and I am well on my way on completing my first calculator.
do { System.out.println("Indicate the operation: "); input.CheckInputType(symbol[count]); } while(symbol[count] != '*');
This code will print "Indicate the operation: " three times before asking for input again IF the symbol isn't *.
Here is the CheckInputType method in case it is needed:
EDIT: Apparently, I cannot add two code tags as of now, I'll blend it with the code up there.
EDIT: That doesn't work either.. I'll just make another post with the second method.
--- Update ---
The method:
package calcPackage; import java.io.IOException; public class TypeCheck2 extends TypeCheck { @SuppressWarnings("static-access") public boolean CheckInputType(char character) { try { character = (char) System.in.read(); } catch (IOException e) { System.out.println("Invalid input!"); return false; } super.symbol[super.count] = character; //The only way I could think of to pass the input back from the method return true; } }