为了账号安全,请及时绑定邮箱和手机立即绑定

可以帮我看一下吗,哪里出现错误了吗

/ 猿问

可以帮我看一下吗,哪里出现错误了吗

慕姐444698 2019-08-04 20:50:31

package com02;


import com01.com001;

import com03.com002;

import com04.com004;


public class com003 {


/**测试类

* @param args

*/

public static void main(String[] args) {

// TODO Auto-generated method stub

com001 x1= new com001("经理","bj001");

com001 x2= new com001("助理","bj002");

com001 x3= new com001("员工","bj003");

//************************************************;


com002 x4= new com002("人事部","rs001");

com002 x5= new com002("管理部","gl001");

com002 x6= new com002("经营部","jy001");

//************************************************;




com004 x7= new com004("张铭",15,"男",x1,x4);

System.out.println(x7.show());

System.out.println("................................");

com004 x8= new com004("西西",24,"女",x2,x5);

System.out.println(x8.show());

System.out.println("................................");

com004 x9= new com004("李泽",21,"男",x3,x6);

System.out.println(x9.show());

System.out.println("................................");

com004 x10= new com004("笔笔",19,"女",x3,x4);

System.out.println(x10.show());

System.out.println("................................");


//*************************************************;


x4.sh1(x7);

x4.sh1(x8);

x4.sh1(x9);

x4.sh1(x10);


System.out.println(x4.getDepartment()+":员工有"+x4.getSum()+"个");




}


}

//************************************************

package com01;

/**

 * 职位类;

 * @author Administrator

 *

 */

public class com001 {

private String job;

private String jobnamber;


//*****************************************************;


public com001(){


}

public com001(String job,String jobnamber){

this.setJob(job);

this.setJobnamber(jobnamber);


}



//******************************************************;


public String getJob() {

return job;

}


public void setJob(String job) {

this.job = job;

}


public String getJobnamber() {

return jobnamber;

}


public void setJobnamber(String jobnamber) {

this.jobnamber = jobnamber;

}




//******************************************************;



package com03;


import com04.com004;


/**

 * 部门类;

 * @author Administrator

 *

 */


public class com002 {

private String department;

private String denamber;

private com004[] mycom004;

private int sum;



//***********************************************************;

public com002(){


}

public com002(String department,String denamber){

this.setDepartment(department);

this.setDenamber(denamber);


}

public com002(String department,String denamber,com004[] mycom004,int sum){

this.setDepartment(department);

this.setDenamber(denamber);

this.setMycom004(mycom004);

this.setSum(sum);



}


//************************************************************;

public String getDepartment() {

return department;

}

public void setDepartment(String department) {

this.department = department;

}

public String getDenamber() {

return denamber;

}

public void setDenamber(String denamber) {

this.denamber = denamber;

}

public com004[] getMycom004() {

if(this.mycom004==null){

this.mycom004= new com004[100];

}

return mycom004;

}

public void setMycom004(com004[] mycom004) {

this.mycom004 = mycom004;

}

public int getSum() {

return sum;

}

public void setSum(int sum) {

this.sum = sum;

}



//************************************************************;


public void sh1(com004 st){

for(int i=0;i<this.getMycom004().length;i++){

if(this.getMycom004()[i]==null){

this.getMycom004()[i]=st;

this.sum=i+1;

return;

}

}

}


//*********************************************

package com04;


import com01.com001;

import com03.com002;


public class com004 {

private String name;

private int age;

private String sex;

private com001 mycom001;

private com002 mycom002;

//******************************************************;


public com004(){


}


public com004(String name,int age,String sex){

this.setName(name);

this.setAge(age);

this.setSex(sex);


}

public com004(String name,int age,String sex,com001 mycom001,com002 mycom002){

this.setName(name);

this.setAge(age);

this.setSex(sex);

this.setMycom001(mycom001);

this.setMycom002(mycom002);

}

    //******************************************************;

public String getName() {

return name;

}


public void setName(String name) {

this.name = name;

}


public int getAge() {

return age;

}


public void setAge(int age) {

if(age<18||age>65){

this.age=18;

}else

    this.age=age;

}


public String getSex() {

return sex;

}


public void setSex(String sex) {

if(sex.equals("男")||sex.equals("女")){

this.sex=sex;

}else

    this.sex = "男";

}


public com001 getMycom001() {

return mycom001;

}


public void setMycom001(com001 mycom001) {

this.mycom001 = mycom001;

}


public com002 getMycom002() {

return mycom002;

}


public void setMycom002(com002 mycom002) {

this.mycom002 = mycom002;

}


//****************************************************;


public String show(){

String str="员工信息如下:\n名字:"+this.getName()+"\n年龄:"+this.getAge()+"\n性别:"+this.getSex()+"\n职位:"+this.getMycom001().getJob()+"\n职位编号:"+this.getMycom001().getJobnamber()+"\n部门:"+this.getMycom002().getDepartment()+"\n部门编号:"+this.getMycom002().getDenamber();

return str;

}



查看完整描述

2 回答

?
安安哥哥

代码和包名太乱了,看不清你的代码

查看完整回答
反对 回复 2019-08-06
?
安安哥哥

贴代码要格式化,选中代码语言编辑菜单再粘贴

https://img1.mukewang.com/5d48de540001f42f06540457.jpg

查看完整回答
反对 回复 2019-08-06

添加回答

回复

举报

0/150
提交
取消
意见反馈 邀请有奖 帮助中心 APP下载
官方微信