public class Tester
{
// instance variables - replace the example below with your own
Scanner operation = new Scanner(System.in);
IntegerCalc calc = new IntegerCalc();
public Tester()
{
char choice;
String value;
char again;
}
public void test()
{
char again = operation.next().charAt(0);
do{
System.out.println("Please pick one of the following operations: 1. Addition 2. Subtraction" +
"3. Multiplication 4.Division 5. Modulo 6. Square 7.Square Root");
int num = operation.nextInt();
int ch;
ch = operation.nextInt();
String choice;
choice = operation.next();
switch (ch){
case 1: calc.addition(num,num);
break;
case 2: calc.subtraction(num, num);
break;
case 3: calc.multiplication(num, num);
break;
case 4: calc.division(num, num);
break;
case 5: calc.modulo(num, num);
break;
case 6:calc.square(num);
break;
case 7: calc.squareRoot(num);
break;
default: System.out.println("Please enter a valid choice number.");
}
System.out.println("Type x to exit");
}while(again != 'x' && again != 'X');
{
System.out.println("Thank you for using my program!");
}
// 这段代码的问题是它甚至没有提示用户输入任何数据,它似乎只是卡在一个循环中,没有做任何事情。任何人都知道我能做些什么来让它工作?