当前位置: 代码迷 >> Eclipse >> 一个简单的键盘输入的java小例子 求 20分赠送
  详细解决方案

一个简单的键盘输入的java小例子 求 20分赠送

热度:35   发布时间:2016-04-23 18:40:15.0
一个简单的键盘输入的java小例子 求高手指点 20分赠送
package   com;


import   java.io.BufferedReader;
import   java.io.IOException;
import   java.io.InputStreamReader;

public   class   ClassManger   {

public   void   classEdit(){
BufferedReader   br=new   BufferedReader(new   InputStreamReader(System.in));

try{
if(br.readLine().equals( "0 ")){

ClassTeam   classTeam=new   ClassTeam();
System.out.println( "请输入班级号: ");


classTeam.setId(br.read());
System.out.println( "请输入班级名称: ");

classTeam.setClassName(br.readLine());
classTeam.info();
}
  }catch(IOException   e){
e.printStackTrace();
}
}
public   static   void   main(String[]   args)   {
Menu   helpMenu=new   Menu();
ClassManger   classManger=new   ClassManger();

java.io.InputStream   s=System.in;
helpMenu.help_Menu();
  BufferedReader   br1
      =   new   BufferedReader(new   InputStreamReader(s));


String   str1=null;
try{
str1=br1.readLine();
System.out.println( "str1= "+str1);

}catch(IOException   e){
e.printStackTrace();
}
Menu   menu1=new   Menu();
if(str1.equals( "0 ")){
menu1.help_Menu();
}else   if(str1.equals( "1 ")){
menu1.setClass_Menu();
classManger.classEdit();
}else   if(str1.equals( "2 ")){
menu1.setPTTeacher_Menu();
}else   if(str1.equals( "3 ")){
menu1.setFTTeacher_Menu();
}

}

}

package   com;


public   class   ClassTeam   {

private   int   id;
private   String   className;



public   ClassTeam(){

}

public   ClassTeam(int   id,String   className){
this.id=id;
this.className=className;
}

public   void   info(){
System.out.println( "班级号: "+this.id);
System.out.println( "班级名称: "+this.className);
}



public   String   getClassName()   {
return   className;
}

public   void   setClassName(String   className)   {
this.className   =   className;
}

public   int   getId()   {
return   id;
}

public   void   setId(int   id)   {
this.id   =   id;
}


}
package   com;


public   class   Menu   {

public   void   help_Menu(){
System.out.println( "*************显示帮助************* ");
System.out.println( "0---------------------显示帮助 ");
System.out.println( "1---------------------设置班级 ");
System.out.println( "2---------------------设置兼职老师 ");
System.out.println( "3---------------------设置专职老师 ");
System.out.println( "4---------------------设置学员 ");
System.out.println( "5---------------------设置课程 ");
System.out.println( "6---------------------设置教师 ");
System.out.println( "7---------------------自我设置 ");
System.out.println( "8---------------------显示信息 ");
System.out.println( "9---------------------推出系统 ");
  相关解决方案