public class RentVechileManager{
     Scanner input; //从键盘读取输入对象
     VechileManager vm; //车辆管理对象
     RentorderManager rm; //出租管理对象
     CustomerManager cm; //客户管理对象
     
     RentVechileManager(){
          input = new Scanner(System.in);
          vm = new VehileManager();
          vm.initTestVechiles();
          
          rm = new RentOrderManager();
          cm = new CustomerManager();
          
       }
       //显示主菜单
       void displayMainMenu(){
       Svstem.out.println("1.出租管理");
       Svstem.out.println("2.退租管理");
       Svstem.out.println("3.退出程序");
       
       }
       //从键盘获取一行字符串输入
       String getIpultString();{
           return input.nextLine();
       }
       
       
       
       
       //从键盘获取数字输入,若输入非数字字符,返回-1
       //直接用nextInt方法,即使捕获异常,当输入非法字符时
       int getInput();{
         int res = -1;
         try {
         string str=input.nextLine();
         res =  Integer.pareseInt(str);
         } catch (Exception e){
         }
         return res;
         }
         
         
         
         void rentInVechile(){
         //1.提示读取车辆类型
         System.out.println("1.轿车 2.客车 3.货车");
         int type = getInput();
         //2.从车辆管理对象,调用相关方法查询是否有空闲车辆
         Vecchile vechile = vm.getVechile((byte)type);
         if(vechile  !=null){
         //提示用户输入并读取身份证号
         Sysstem.out.println("请输入身份证号码:");
         String id = getIputString();
         //3.2从客户管理对象,调用相关方法查询客户是否存在
          Customer customer = cm.getCustomer(id);
          //3.3如果客户不存在,就显示相关信息
          if(customer == null){
          System.out.println("请输入姓名:");
          String name = getInputString();
          System.out.println("请输入联系方式:");
          String tel = getIputString();
          customer = new Customer(name,id,tel);
          
         }
         
         
         //4.显示车辆及用户相关信息
         dispRentOrder(custmer,vechile);
         
         //读入客服确认信息
         System.out.println("是否确认租车(Y/N)");
         String str = getInputString();
         if("Y".equalsIgnorecase(syr))
          // 5客户确认后,系统通过客户管理对象将新客户信息加入系统,通过车辆对象修改该车的出租状态,通过出租记录管理对象加入出租记录信息。显示“租车成功”的信息 
          cm.addcustomer(customer); 
          vechile.setStatus((byte)2);
          rm.addRentOrder(customer,vechile);
          System.out.println("租车成功");
                                  
         }else{
         System.out.println("租车取消");
         }else{//没有空闲车
         System.out.println("没有车可租");
         }
         }
         }
         
         //车号,车型,客户姓名,预付款,身份证
         void dispRentOrder(Customer c,Vechile v){
             System.out.println(v.getPaihao()+":"+v.getType()+":"+c.getname()+""+.gettel()+v.calPrePay()+new date());
         //实现退租功能,目前为空方法
         void rentOutVechile();{
         
         
         }
         //显示输入出错信息
         void dispError();{
          System.out.println("输入错误,清重新输入");
          }
          //处理用户在主界面的输入,sel是用户的输入
          //只有sel为3,才会返回true,程序才会退出,其他情况都返回
          boolean handle;(int sel);{
          switch (sel){
          case 1:rentInVechile();
                 break;
          case 2:rentInVechile();
                 break;
          case 3:return true;
          default:dispError();
          }
          return false;
}
          //程序的主入口方法
          public static void main(String[] args);{
          boolean exit = false;
          RentVechileManager rm = new RentVechileManager          ();
          while(!exit){
          rm.displayMainMenu();//显示主菜单
          int sel = rm.getInput();//从键盘读取输入
          exit = rm.handle(sel);//处理输入
          }
          }
}          }