私はクリケット選手を代表するクラスを書いています。クリケット選手の4つのタイプがありますクラス内の異なる種類のプレイヤーを表す
1改札プレーヤー
2打者
3ボウラー
4オールラウンダー
私は正しい道
public class Player {
final static int WICKETPLAYER=1;
final static int BATSMAN=2;
final static int BOWLER=3;
final static int ALLROUNDER=4;
int currentbatting;
int bowlerbating;
int playertype;
public Player(int i,int currentbatting){
this.currentbatting=currentbatting;
playertype=i;
}
public String whatTypeOFplayer(){
switch(playertype){
case WICKETPLAYER:
return "wicketplayer" ;
case BATSMAN:
return " batsman";
case BOWLER:
return "bowler";
case ALLROUNDER:
return "allrounder";
default:
return "error";
}
}
}
で選手を代表していた場合、私はわからないんだけど
これはcodereview.stackexchange.comに属します。 – Tsar