大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
要是oracle多好,一句话搞定。
成都创新互联公司秉承实现全网价值营销的理念,以专业定制企业官网,网站建设、成都网站设计,微信小程序定制开发,网页设计制作,成都手机网站制作,全网整合营销推广帮助传统企业实现“互联网+”转型升级专业定制企业官网,公司注重人才、技术和管理,汇聚了一批优秀的互联网技术人才,对客户都以感恩的心态奉献自己的专业和所长。
既然是java,给你伪代码,你补充吧:
String getDeptName(int level,String dept){
if(level==0){
return dept;
}else if(level=10){
return "层数太大";
}else{
return getDeptName(level-1,dept-childDeptName);
}
}
参考代码:
class Department {
private String dName;
private static Double dMoney;
private Integer dPeople;
public Department(String dName, Integer dPeople) {
this.dName = dName;
this.dPeople = dPeople;
}
public void consume(double c) {
if (c = dMoney) {
dMoney = dMoney - c;
} else {
dMoney = 0D;
System.out.println("账户已清零!");
}
}
public String getdName() {
return dName;
}
public void setdName(String dName) {
this.dName = dName;
}
public static Double getdMoney() {
return dMoney;
}
public static void setdMoney(Double dMoney) {
Department.dMoney = dMoney;
}
public Integer getdPeople() {
return dPeople;
}
public void setdPeople(Integer dPeople) {
this.dPeople = dPeople;
}
}
public class Demo {
public static void main(String[] args) {
Department.setdMoney(300D);
Department d1 = new Department("部门1", 20);
Department d2 = new Department("部门2", 10);
d1.consume(80);
d2.consume(40);
System.out.println("剩下的钱:" + Department.getdMoney());
}
}
输出结果:
输出结果
/**
* 职工类
*/
public class Employee {
private String identifier;//职工编号
private String name;//职工姓名
public Employee() {
}
public Employee(String identifier, String name) {
this.identifier = identifier;
this.name = name;
}
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void work() {
System.out.println("工作时间:周一至周五,朝九晚五");
}
public void showInfo() {
System.out.println("编号:"+getIdentifier()+",姓名:"+getName());
}
}
/**
* 经理类
*/
public class Manager extends Employee{
private String department;//工作部门
public Manager(String identifier, String name) {
super(identifier, name);
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
@Override
public void showInfo() {
System.out.println("编号:"+getIdentifier()+",姓名:"+getName()+",负责的工作部门:"+getDepartment());
}
}
/**
* 董事长类
*/
public class Chairman extends Employee{
@Override
public void work() {
System.out.println("董事长主持召开股东大会");
}
}
/**
* 测试类:类名DemoTest03
*/
public class DemoTest03 {
public static void main(String[] args) {
Employee e = new Employee("07","益达");
Manager m = new Manager("01","小黑");
m.setDepartment("爱情公寓");
Chairman c = new Chairman();
e.showInfo();
e.work();
m.showInfo();
c.work();
}
}
如果纯用Java的话,最好采用Swing,这样利于用户交互,但是现在估计没有谁有那个源代码的了,lz还是自己努力一下,亲手实践才是自己的……