zoukankan      html  css  js  c++  java
  • 第六次作业

     class Check{
             public boolean validate(String name,String password){
                 if(name.equals("wupeng")&&password.equals("aaaa"))
                     return true;
                 
                 else{
                     return false;
                 }
                 
             }
     }
     class Operate{
         private String info[];
     public Operate(String info[]){
         this.info=info;
     }
     public String login(){
         
         Check check=new Check();
         this.isExit();
         String name=this.info[0];
         String password=this.info[1];
         String str=null;
         if(check.validate(name,password)){
             str="欢迎"+name+"光临!";
         }
         else{
             str="错误的用户名和密码!";
         }
         
             return str;
     }
     public void isExit(){
         if(this.info.length!=2){
             System.out.println("输入参数不正确,程序退出~");
                System.out.println("格式:java LoginDemo1 用户名 密码");
                System.exit(1);
             
             }
         } 
         
     }
    public class LoginDemo2 {
    
        public static void main(String args[]){
                Operate oper=new Operate(args);
                System.out.println(oper.login());
        }
    }
  • 相关阅读:
    min_25筛入门
    [湖南集训]更为厉害/谈笑风生
    [ARC060D] 最良表現
    [CQOI2007]矩形
    [SCOI2009]粉刷匠
    PAT乙级1030
    PAT乙级1028
    PAT乙级1029
    PAT乙级1026
    PAT乙级1027
  • 原文地址:https://www.cnblogs.com/ouyu/p/6651882.html
Copyright © 2011-2022 走看看