坐等答案,這個類有什么問題??
有人在線嗎??
package base;
import java.util.InputMismatchException;
import java.util.Scanner;
public class clerkNew {
?String [] clerk01=new String [9];//定義一個數組clerk00,用于存放某個職員信息
?String [] clerk00={"序號","姓名","證件號碼","聯系電話","職位","崗位","入職日期","離職日期","備注"};//定義一個數組clerk00,用于存放某個職員信息
?
?public void clerkInput(){
? System.out.println("添加新職員信息請選擇1;其他請選擇2");//提示是否選擇添加新職員
? Scanner functionNum0=new Scanner(System.in);
? try{
?? int funtionNum=functionNum0.nextInt();
? }catch(InputMismatchException e){
?? System.out.println("輸入代碼錯誤,請重新輸入:");
? }catch(Exception e ){
?? System.out.println("系統異常,請聯系工作人員");
? }finally{
?? System.out.println("系統繼續進行:");
?? int funtionNum=functionNum0.nextInt();
? }
?
? if(funtionNum==1){
??? for(int i=0;i<9;i++){
???? System.out.println("請輸入新職員的"+clerk00[i]);
???? Scanner input =new Scanner(System.in);
???? clerk01[i]=input.next();
??? }
?? }if(funtionNum==2){
??? System.out.println("歡迎光臨東風日產派工系統?。?!");
?? } else{
??? System.out.println("輸入代碼錯誤請重新輸入!請輸入正確的功能代碼:1或者2");
?? }
??
?
? }
?public void clerkPrint(){
? System.out.println("是否顯示新職員信息:是 1 否2");
? Scanner printNum0=new Scanner(System.in);
? int printNum=printNum0.nextInt();
? if(printNum==1){
? ?? System.out.print("新職員的信息如下:");
?? for(int i=0;i<9;i++){
??? System.out.print(clerk01[i]+"? ");
?? }
? }else{
?? System.out.println("返回添加新職員界面?。?!");
? }
?
?
?}
?
?
?public static void main(String[] args) {
? clerkNew clN=new clerkNew();
? clN.clerkInput();
? clN.clerkPrint();
}
2015-10-28
這一段代碼改為?
if(funtionNum==1){
??? for(int i=0;i<9;i++){
???? System.out.println("請輸入新職員的"+clerk00[i]);
???? Scanner input =new Scanner(System.in);
???? clerk01[i]=input.next();
??? }
?? } else if(funtionNum==2){
??? System.out.println("歡迎光臨東風日產派工系統!??!");
?? } else{
??? System.out.println("輸入代碼錯誤請重新輸入!請輸入正確的功能代碼:1或者2");
?? }