- 分享
- 0
- 人气
- 0
- 主题
- 23
- 帖子
- 424
- UID
- 250015
- 积分
- 235
- 阅读权限
- 14
- 注册时间
- 2009-7-29
- 最后登录
- 2016-12-5
- 在线时间
- 932 小时
|
public static void stopsell(Item[] item)
{
if(noitemsearch==0)
{
System.out.println("No item!!");
}
else
{
int itemcode=0,confirm=0,truefalse=0,cont=0,process=0;
boolean wronginput=true;
String code="";
Scanner stopsell = new Scanner(System.in);
try{
System.out.print("Choose which item code you want to stop sell :");
code = stopsell.next();
itemcode = Integer.parseInt(code);
}
catch(Exception e){
System.out.println("Invalid input");
stopsell(item);
}
for(int i=0;i<item.length;i++)
{
if(item[i].equal(itemcode))
{
wronginput=true;
do{
try{
System.out.print("Confirm to stop sell this item?(enter 0 for confirm):");
confirm = stopsell.nextInt();
wronginput = false;
}
catch(InputMismatchException e){
invalidinput();
stopsell.nextLine();
}
}while(wronginput);
if(confirm == 0)
{
item[i].setSts(0);
truefalse=1;
process=1;
}
else
{
item[i].setSts(1);
System.out.println("Input number was cancel selling");
truefalse=1;
process=0;
}
}
}
if(process==1)
{
System.out.println("Process stop selling has been done");
System.out.println("");
//menu();
}
if(truefalse==0)
{
invalid();
System.out.print("Try again type 1/exit to menu type other integer: ");
cont = stopsell.nextInt();
if(cont==1)
{
stopsell(item);
}
else
System.out.println("");
}
}
//menu();
}
幹嘛我的method一直跳回去的,不會出去別的method的? |
|