Swich case without a break
Data collection process
private void operator1(String title, String[] menu, Scanner scanner) {
int[] data = new int[4];
String[] subTitle = { "숫자를 입력해주세요 ", "연산자를 선택해주세요", "숫자를 입력해주세요", "연산결과" };
int subTitleIdx = 0;
String temp = new String(), message = new String();
{
boolean loopcheck = true, isFormula =false;
int step = 12;
while (loopcheck) {
this.display(title);
switch (step) {
case 12:
case 22:
case 32:
case 42:
step++;
case 13:
case 23:
case 33:
case 43:
if (step != 43)
step += 9;
else
loopcheck = false;
this.display(subTitle[(step / 10) - 1]);
if(message != null) { //메시지처리
this.display(message);
message = null;
}
if(isFormula) { this.display("[수식]");
for(int dataIdx=0; dataIdx<data.length; dataIdx++) {
if(data[dataIdx] !=0) {
this.display(" " + (dataIdx == 1? this.convertToOperator(data[dataIdx]):data[dataIdx]));
this.display("\n");
}else {
break;
}
}
}
}
// this.display(message!=null?message:""); //메시지가 출력되면 출력하고, 안되면 지워! (적합하지 않은 식)
//수식이 있을때와 없을 때?
}
}
}
Comments
Post a Comment